#P6933. Speedometer Correction

    ID: 20140 Type: Default 1000ms 256MiB

Speedometer Correction

Speedometer Correction

Sheila is a student who drives an old, slow, rusty car that is falling apart. Recently, the needle on her speedometer fell off and she reattached it, but possibly at the wrong angle. As a result, when the speedometer shows a reading s, her true speed is s + c, where c is an unknown constant (which may be negative).

Sheila recorded a journey that consisted of n segments. In the ith segment she traveled a distance of di with her speedometer reading si during the entire segment. The total time for the journey was t. Your task is to help Sheila determine the value of c such that

$$\sum_{i=1}^{n} \frac{d_i}{s_i + c} = t$$

It is guaranteed that for each segment the true speed, i.e. si + c, is greater than zero.

inputFormat

The first line contains two numbers: an integer n and a real number t, where n represents the number of journey segments and t is the total time taken.

Each of the following n lines contains two real numbers: di and si, which represent the distance traveled and the speedometer reading for the ith segment respectively.

It is guaranteed that with the correct c, each si + c > 0.

outputFormat

Output the constant c. Your answer is accepted if its absolute or relative error does not exceed 10-7.

sample

3 10
100 20
150 25
200 30
5.000000000

</p>