## LCC '18 Contest 4 S1 - Damage Calculation

View as PDF

Points: 5
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Catarina loves playing ARPGs, specifically Diablo-style games, and spent all of Winter break playing them. One thing in common with a lot of these games is their item system: each item has at most $$6$$ damage modifiers (mods), each of which is one of three types:

• X added damage: this mod adds a flat amount of damage.
• Y increased damage: this mod increases the base damage by $$Y\%$$.
• Z more damage: this mod increases the total damage by $$Z\%$$.

Damage calculation is then performed as follows: first, all the flat damage mods are added together to determine the item’s base damage. Then, the increased damage mods are applied additively to the base damage value. Finally, the more damage mods are applied multiplicatively to the resulting damage value.

For example, suppose an item has the following mods:

• 40 added damage
• 60 added damage
• 30 increased damage
• 20 increased damage
• 100 more damage
• 100 more damage

This item has a base damage of $$40+60 = 100$$, which is then increased by $$30\%+20\%=50\%$$, giving it a total of $$150$$ damage. The $$50\%$$ more multipliers then give it a total of $$150\times 2\times 2 = 600$$ damage.

All this confusion makes comparing the damage of different items very difficult, so Catarina has asked for your help to write a program that determines an item’s damage. Can you help her out?

#### Input Specification

The first line of input contains an integer $$N$$ $$(1 \le N \le 6)$$, the number of modifiers on an item. The next $$N$$ lines each contain a damage modifier in the format described above.

#### Output Specification

Output the total damage of the item. Your output will be considered correct if it has an absolute or relative error of at most $$10^{-6}$$.

#### Sample Input 1

6
30 increased damage
20 increased damage
100 more damage
100 more damage

#### Sample Output 1

600

#### Sample Input 2

2
100 increased damage
100 more damage

#### Sample Output 2

0