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!
, 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
- 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.
is 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
The next
The next
Output Specification
The maximum amount of health points
can have remaining, rounded to two decimal places.If Act Like A Cactus.
.
Sample Input 1
Copy
100 2 2
0 50
10 0
0 10 11
5 1 50
Sample Output 1
Copy
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
Copy
10 1 1
10 50
3 1 50
Sample Output 2
Copy
Act Like A Cactus.
Comments