Imagine that you have been hired in the IT department of a chain grocery store. Starting next month, it is planned to introduce a 20% discount on some products. You are required to write a program for calculating the final cost of the purchase, taking into account all discounts.
A purchase is specified as a list of products, where each product is described in the format <ItemName> <price> x<quantity>. If the name of the product
not ends with the substring "fixed", then the price of the product at the final calculation of the purchase is reduced by 20%, rounded down to the nearest whole number. So, for example, if the price of the goods was 12 rubles, taking into account the discount, it will be 9 rubles. Products whose name ends with the "fixed" substring are not eligible for the discount.
The total cost of each product is calculated using the formula finalPrice⋅x, where finalPrice is the final price, possibly including discounts and rounding, and x is the quantity of the product in the shopping list.
Your task is to calculate the total cost of the purchase.
Input
The first line contains the number n - the number of items in the purchase (1≤n≤1000).
The next n lines contain descriptions of the items in the purchase in the format: <ItemName> <price> x<number>.
The product name consists of no more than 20 lowercase Latin letters. Price - a natural number that is strictly greater than 1, but not more than 1000. Quantity - a natural number not greater than 100.
Imprint
Print one number - the total cost of the purchase.
Examples
# |
Input |
Output |
Explanation |
1 |
5
bananassale 10x2
breadfixed 5 x5
colafixed 20x2
gumsale 9x10
tea 2x15 |
166 |
In the test from the example, the total cost of goods will be: 8, 5, 20, 7 and 1, respectively.
Total purchase price: 8⋅2+5⋅5+20⋅2+7⋅10+1⋅15=166$. |