405223: GYM101848 G Too Hot, Too Cold

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Too Hot, Too Coldtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

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.

Input

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

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.

ExamplesInput
3 2
50 5
75 2
100 5
Output
53.333333333
Input
2 2
500 2
1000 1
Output
1000.000000000
Input
1 1
1 1
Output
1.000000000
Note

The water temperature can be arbitrarily low, even if this breaks some physical laws.

Figure that will explain Example 1:

加入题单

算法标签: