| 2018 ECNU Campus Invitational Contest |
|---|
| Закончено |
It's strange that the water temperature in the bathroom is changing during my shower.
Actually, the temperature varies with patterns. The time interval in which I take the shower is [0, z]. Assuming the water temperature initially at time 0 is y, it changes gradually and linearly from y to y + y1 during the time [0, t1]; then changes linearly from y + y1 to y + y2 during the time [t1, t2]; so on and so forth; finally, changes linearly from y + yn - 1 to y + yn during the time [tn - 1, tn]. Thus, it forms a broken line.
As a human being, I can only do my shower with water temperature between 30 and 30 + h, inclusively. As a lazy human being, I only want to change the water temperature before I start to take the shower. You are asked to find out for how much time at most I can enjoy my shower.
The first line contains two space-separated integers n and h (1 ≤ n ≤ 105, 0 ≤ h ≤ 2·105).
The next n lines each contain two space-separated integers, denoting (t1, y1), (t2, y2), ..., (tn, yn), respectively. (1 ≤ t1 < t2 < ... < tn = z ≤ 106, - 105 ≤ yi ≤ 105).
Output the maximum time I can take the shower if I choose the initial temperature optimally. Your answer is required to have absolute or relative error less than 10 - 6.
3 2
50 5
75 2
100 5
53.333333333
2 2
500 2
1000 1
1000.000000000
1 1
1 1
1.000000000
The water temperature can be arbitrarily low, even if this breaks some physical laws.
Figure that will explain Example 1:
| Название |
|---|


