has some amazing super powers! One day, he was in the desert, fighting off bad guys. The battle got very serious, and he needs your help to win the battle!
different sets of plant armor, and each of the armor has 3 sets of properties.
has- , the toughness of the armor, which reduces the incoming damage by .
- , the shock absorption of the armor, which reduces the remaining damage by .
- At any given time, at most one plant armor can be used, and plant armors can be reused.
There are enemies and they all have a set duration of attack, for each enemy:
- They have a start time , representing the start time of the attack in seconds.
- They have a duration of attack, which is , which means the enemies damage up to the second, starting from the second.
- They have an attack damage, , meaning enemies do points of damage every second that they are attacking.
health points, meaning that he can take up to points of attack damage.
starts withis concentrating on the battle, and is confused on the optimal usage of his armor, can you help him? You are to help him find the maximum amount of health points he has left, if he uses his plant armors optimally.
Input Specification
The first line contains the integers , , , denoting the number of health points, enemies, and armor sets respectively.
The next lines each contain two integers, and .
The next lines each contain three integers, , and .
Output Specification
The maximum amount of health points
can have remaining, rounded to two decimal places.If Act Like A Cactus.
.
Sample Input 1
100 2 2
0 50
10 0
0 10 11
5 1 50
Sample Output 1
60.50
Explanation for Sample Output 1
should use plant armor #1 during the fifth second.
During all other times, he should use plant armor #2 to block more of the incoming damage.
Sample Input 2
10 1 1
10 50
3 1 50
Sample Output 2
Act Like A Cactus.
Comments