QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#2771. Need for Speed

Statistics

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 $s$, her true speed is $s+c$, where $c$ is an unknown constant (possibly negative).

problem_2771_5ba1e4d416c1e49ecad1d0b28eba330a.png

Sheila made a careful record of a recent journey and wants to use this to compute $c$. The journey consisted of $n$ segments. In the $i$th segment she traveled a distance of $d_i$ and the speedometer read $s_i$ for the entire segment. This whole journey took time $t$. Help Sheila by computing $c$.

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 $n$ ($1 \le n \le 1\,000$), the number of sections in Sheila’s journey, and $t$ ($1 \le t \le 10^6$), the total time. This is followed by $n$ lines, each describing one segment of Sheila’s journey. The $i$th of these lines contains two integers $d_i$ ($1 \le d_i \le 1\,000$) and $s_i$ ($|s_i| \le 1\,000$), the distance and speedometer reading for the $i$th segment of the journey. Time is specified in hours, distance in miles, and speed in miles per hour.

Output

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

Examples

Input 1

3 5
4 -1
4 0
10 3

Output 1

3.000000000

Input 2

4 10
5 3
2 2
3 6
3 1

Output 2

-0.508653377

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.