405009: GYM101736 I LASER SHIELDs
Description
Our green Cactus friend is in danger again! A hostile troop of cacti is trying to attack this lonely cactus. Luckily, Cactus happens to have N LASER SHIELDs. However, Cactus can only activate up to k LASER SHIELDs, and he wants you to help him determine the best way to use k LASER SHIELDs.
Each LASER SHIELD has an activation time ti at which it can be activated. If it is not activated at that time, it loses its power and becomes useless forever. Each LASER SHIELD has an initial power pi and a corrosion rate ri. When a LASER SHIELD is activated, it will have the initial power pi and lose power at the rate of ri power units per second. When the power of a LASER SHIELD drops below 0, it becomes inactive and cannot be used again.
Define the defense power at a specific time to be the maximum power over all activated shields. The defense power is 0 if there are no active shields. Define the protection of Cactus to be the minimum defense power at any time during the attack.
Cactus used w3m to look into the future, seeing that the hostile cacti begin their attack at time ts and end their attac at time te. Your task is to determine the maximum possible protection of Cactus.
InputThe first line contains a two space-separated integers n and k (0 ≤ n, k ≤ 105), the total number of LASER SHIELDs and the number of LASER SHIELDs that Cactus can activate respectively.
Each of the next n lines contains three space-separated integers ti, pi, and ri (0 ≤ ti ≤ 109;1 ≤ pi, ri ≤ 109), describing the ith LASER SHIELD.
The last line of input contains two space-separated integers ts and te (0 ≤ ts < te ≤ 109), the start and end times of the attack respectively.
OutputPrint, on a single line, the maximum possible that can be achieved.
ExampleInput4 3Output
2 10 4
3 6 1
7 3 1
8 12 1
4 9
2Note
In the first sample, it is optimal to activate the second, third, and fourth shields.