Races
Fred and George have created an exciting new game. They construct stairs using thick books and mark a finish line at a certain distance away. Players take turns placing their cars on a launch ramp. The cars accelerate due to gravity, leap over the steps, and eventually come to a stop because of friction. The winner is the player whose car stops closest to the finish line.
Your task is to write a program that calculates the exact position where the car should be placed so that it stops precisely on the finish line. Assume the gravitational acceleration is 10 m/s(^2). Friction applies an acceleration of 1 m/s(^2) on both the launch ramp and the horizontal sections of the path. The vertical component of velocity is entirely dissipated after the launch ramp or jump (kinetic energy is converted into internal energy). Consider the car to be a point. The launch ramp is inclined at an angle of 45°.
Input
The first line of the input contains two integers separated by a space: the number of steps on the stairs N (1 ≤ N ≤ 10) and the distance from the bottom step to the finish line R (10 ≤ R ≤ 200). The next N lines each contain two integers separated by a space: the length of the step L_i (5 ≤ L_i ≤ 25) and the height of the step H_i (1 ≤ H_i ≤ 10). The steps are described starting from the top. All distances and heights are given in centimeters.
Output
Output a single number with 6 decimal places on the first line: the distance in centimeters from the lower boundary of the launch ramp to the position where the car should be placed. If there are multiple possible positions, output the smallest distance.