hiddencactus 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!
hiddencactus has different sets of plant armor, and each of the armor has 3 sets of properties.
- , 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 hiddencactus 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.
hiddencactus starts with health points, meaning that he can take up to points of attack damage.
hiddencactus 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.
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 .
The maximum amonut of health points hiddencactus can have remaining, rounded to two decimal places.
If hiddencactus cannot sustain all the damage, you are to output
Act Like A Cactus..
Sample Input 1
100 2 2 0 50 10 0 0 10 11 5 1 50
Sample Output 1
Explanation Of Sample 1
hiddencactus 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.