ICPC 2017 · Problem E · Need for Speed

41st ICPC · Rapid City, United States

Statement

Time limit: 1 second

Sheila is a student and she drives a typical student car: it is old, slow, rusty, and falling apart. Recently, the needle on the speedometer fell off. She glued it back on, but she might have placed it at the wrong angle. Thus, when the speedometer reads ss, her true speed is s+cs+c, where cc is an unknown constant (possibly negative).

Sheila made a careful record of a recent journey and wants to use this to compute cc. The journey consisted of nn segments. In the iith segment she traveled a distance of did_{i} and the speedometer read sis_{i} for the entire segment. This whole journey took time tt. Help Sheila by computing cc.

Note that while Sheila’s speedometer might have negative readings, her true speed was greater than zero for each segment of the journey.

Input

The first line of input contains two integers nn (1n10001 \le n \le 1 000), the number of sections in Sheila’s journey, and tt (1t1061 \le t \le 10^{6}), the total time. This is followed by nn lines, each describing one segment of Sheila’s journey. The iith of these lines contains two integers did_{i} (1di10001 \le di \le 1 000) and sis_{i} (si1000|s_{i}| \le 1 000), the distance and speedometer reading for the iith segment of the journey. Time is specified in hours, distance in miles, and speed in miles per hour.

Output

Display the constant cc in miles per hour. Your answer should have an absolute or relative error of less than 10610^{- 6}.

Sample Input 1

3 5
4 -1
4 0
10 3

Sample Output 1

3.000000000

Sample Input 2

4 10
5 3
2 2
3 6
3 1

Sample Output 2

-0.508653377

ACM-ICPC World Finals 2017 Problem E: Need for Speed

No official solution in the source collection.