#C1949. Taco Revenue Calculation

    ID: 45210 Type: Default 1000ms 256MiB

Taco Revenue Calculation

Taco Revenue Calculation

You are given data sets representing transactions at a taco shop. Each transaction is represented by the customer's age and the time of the visit. The ticket price is determined by the following rules:

$$ \text{Price} = \begin{cases} 5 & \text{if } \text{age} \leq 12,\\ 12 & \text{if } 12 < \text{age} \leq 59,\\ 7 & \text{if } \text{age} \geq 60. \end{cases} $$

In addition, if the visit occurred in the morning (i.e. the time string is "morning"), a discount of 20% is applied:

$$ \text{Discounted Price} = \text{Price} \times 0.80. $$

You need to process multiple data sets. For each data set, the first line contains an integer T (the number of transactions). Each of the following T lines contains a transaction in the format "age time". The input terminates when T is 0. For each data set, output the total revenue (after applying discounts if applicable), formatted to two decimal places.

inputFormat

The input consists of multiple datasets. Each dataset starts with an integer T indicating the number of transactions. The following T lines each contain two items: an integer age and a string time (one of 'morning', 'afternoon', or 'evening'). The input terminates with a line containing a single 0.

outputFormat

For each dataset, print the total revenue on a separate line. The revenue should be rounded to two decimal places.

## sample
3
5 morning
45 afternoon
70 evening
4
10 evening
55 morning
60 morning
20 afternoon
0
23.00

32.20

</p>