Recipe
Time limit1sMemory limit1024 MB
Given N ingredients with amounts at home, amounts needed, and unit prices, the task is to sum the cost of the missing amounts.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
You have decided to cook. The dish needs ingredients. For each ingredient, you know how much you already have at home, how much the recipe needs in total, and the price of one unit if you have to buy it. You buy exactly the amount you are missing. Compute the total cost of the ingredients.
Input
The first line contains an integer (), the number of ingredients.
Each of the next lines contains three integers (, ): the amount you have, the amount needed, and the cost of one unit.
Output
Print a single integer, the total cost of the ingredients.