#D6068. Rings
Rings
Rings
Problem
A dolphin who lives in a certain aquarium will be rewarded if he jumps and goes through the ring.
- Dolphin jumps from coordinates and lands at .
- The trajectory of the jump is a parabola.
- The th ring is determined to have passed through when the jump trajectory intersects the line segment connecting and .
- jump requires as much physical strength as the initial velocity.
Dolphins can jump as many times as they want. Let the gravitational acceleration vector be and find the minimum total physical strength required for the dolphin to pass through all the rings. However, suppose friction and air resistance are negligibly small.
Constraints
The input satisfies the following conditions.
- All inputs are integers.
Input
The input is given in the following format.
First, and are given to the line. Then the line is given the position of the th ring, , , and .
Output
Output the answer on one line. If the absolute error or relative error is or less, the answer is judged to be correct.
Examples
Input
100 5 50 1 5 50 5 10 50 20 30 50 40 60 50 61 1000000
Output
48.6090201099
Input
64 15 38 133177 927361 48 177920 668766 12 680425 790550 43 6853 384115 17 214954 723798 62 63843 153825 28 399349 482937 2 336136 367001 33 138008 733496 6 203462 911631 58 321974 527734 17 696940 781678 55 265874 507640 41 56037 880001 34 279422 528651
Output
6087.909851326286
inputFormat
input satisfies the following conditions.
- All inputs are integers.
Input
The input is given in the following format.
First, and are given to the line. Then the line is given the position of the th ring, , , and .
outputFormat
Output
Output the answer on one line. If the absolute error or relative error is or less, the answer is judged to be correct.
Examples
Input
100 5 50 1 5 50 5 10 50 20 30 50 40 60 50 61 1000000
Output
48.6090201099
Input
64 15 38 133177 927361 48 177920 668766 12 680425 790550 43 6853 384115 17 214954 723798 62 63843 153825 28 399349 482937 2 336136 367001 33 138008 733496 6 203462 911631 58 321974 527734 17 696940 781678 55 265874 507640 41 56037 880001 34 279422 528651
Output
6087.909851326286
样例
64 15
38 133177 927361
48 177920 668766
12 680425 790550
43 6853 384115
17 214954 723798
62 63843 153825
28 399349 482937
2 336136 367001
33 138008 733496
6 203462 911631
58 321974 527734
17 696940 781678
55 265874 507640
41 56037 880001
34 279422 528651
6087.909851326286