Collision balls
Hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
The horizontal flat surface rolling two balls of radius R meters each. At the initial time balls are the coordinates of points (x_1, y_1) and (x_2, y_2) and the velocity projections on the coordinate axes dx_1 dy_{1 }and dx_2 dy_2 meters per second, respectively.
Required to find the time in seconds, after which balls faced, or determine that it will not happen.
Input
The input file contains the real numbers R x_1 y_1 dx_1 dy_1 x_2 y_2 dx_2 dy_2.
Output
Output file must contain a real number - the time before the collision, accurate to 3 significant digits after the decimal point, or −1, if no collision occurs.
1 ≤ R ≤ 1000, -1000 ≤ x_1, y_1, dx_1, dy_1, x_2, y_2, dx_2, dy_2 ≤ 1000
Examples
Input #1
Answer #1
Submissions 327
Acceptance rate 5%