Scaling Recipes
A recipe is a list of ingredients and a set of instructions to prepare a dish. It is often written for a particular number of portions. If you have a recipe for 4 portions and you want to make 6 portions, itturns out that simply multiplying the amounts for each ingredient by 1.5 is often wrong! The reason is that the original recipe may have been rounded to the nearest teaspoon, gram, etc., and the rounding errors magnify when a recipe is scaled.
Some recipes are specifically written to ease the task of scaling. These recipes are developed using "Baker's percentages". Each ingredient is listed not only by weight (in grams), but also as a percentage relative to the "main ingredient". The main ingredient will always have a 100% Baker's percentage. Note that the sum of the Baker's percentages from all ingredients is greater than 100%, and that the Baker’s percentages of some ingredients may exceed 100%.
To scale a recipe:
determine the scaling factor by dividing the number of desired portions by the number of portions for which the recipe is written;
multiply the weight of the main ingredient with a 100% Baker's percentage by the scaling factor. This is the scaled weight of the main ingredient;
calculate the scaled weight of every other ingredient by multiplying its Baker's percentage by the scaled weight of the main ingredient.
Input
The first line specifies a positive integer t (t ≤ 1000), consisting of the cases to follow. Each case starts with a line with three integers r, p and d: r (1 ≤ r ≤ 20) is the number of ingredients, p (1 ≤ p ≤ 12) is the number of portions for which the recipe is written, and d (1 ≤ d ≤ 1000) is the number of desired portions. Each of the next r lines is of the form
< name > < weight > < percentage >
where < name > is the name of the ingredient (an alphabetic string of up to 20 characters with no embedded spaces), < weight > is the weight in grams for that ingredient, and <percentage> is its Baker's percentage. Both < weight > and < percentage > are floating-point numbers with exactly one digit after the decimal point. Each recipe will only have one ingredient with a Baker's percentage of 100%.
Output
For each case, print Recipe # followed by a space and the appropriate case number (see sample output below). This is followed by the list of ingredients and their scaled weights in grams. The name of the ingredient and its weight should be separated by a single space. Each ingredient is listed on its own line, in the same order as in the input. After each case, print a line of 40 dashes ('-'). Answers within 0.1g of the correct result are acceptable.