The magician Dongdong has a beautiful magic garden, where he has planted all kinds of magical plants, and the garden is filled with colorful flowers all year round. Dongdong's friends especially love to come to the garden to play.
The garden's irrigation system was specially designed by Dongdong. He used magic to create $n$ sprinklers above the garden, all of which are connected to a nearby holy water river. When irrigating, all sprinklers spray streams of water simultaneously, which trace beautiful arcs in the air and eventually land exactly on the $n$ most water-deprived magical plants.
Figure 1. The trajectory of the water sprayed from a sprinkler
Dongdong has set every sprinkler at the same horizontal height $h$. All sprinklers are placed horizontally. When water is sprayed from a sprinkler, it has only a horizontal velocity (the horizontal velocity of each sprinkler may be different). There is no wind in the magic garden, and air resistance can be ignored. Therefore, under the influence of gravity (the gravitational acceleration of the magic garden is $g$), the trajectory of the water is a perfect parabola. Any point in space is sprayed by at most three sprinklers, and the intersection of two water streams does not affect their respective trajectories.
In recent years, many factories have been built near the magic garden, and the holy water river has been polluted. Dongdong does not want the polluted water to affect his garden, so he must use magic to purify the irrigation water first. Dongdong's magic can only purify the water sprayed from the sprinklers. He can cast a spell to form a convex polygonal water-filtering layer on a horizontal plane in the air. All water passing through the filtering layer will be purified. The energy required to cast this spell is proportional to the area of the filtering layer, with 1 unit of magic energy required per square meter of the filtering layer. Dongdong wants to purify all the water; what is the minimum amount of energy he needs?
To better describe the problem, Dongdong established a three-dimensional Cartesian coordinate system in the garden, with the northwest corner of the garden as the origin. The positive direction of the $x$-axis is to the east, the positive direction of the $y$-axis is to the south, and the positive direction of the $z$-axis is upward. Thus, the position of the $i$-th sprinkler can be represented as $(x_i, y_i, h)$, and the position of the $j$-th magical plant can be represented as $(x_j', y_j', 0)$.
Input
The first line contains two real numbers $h$ and $g$, representing the height of the sprinklers and the gravitational acceleration of the magic garden. The second line contains an integer $n$, representing the number of sprinklers.
The next $n$ lines each contain four integers $x_i, y_i, x_i', y_i'$, separated by spaces. This indicates that the $i$-th sprinkler is at $(x_i, y_i, h)$, and the water it sprays lands exactly on the magical plant at $(x_i', y_i', 0)$.
Output
The output should contain a single real number, representing the minimum energy Dongdong needs, accurate to at least 3 decimal places.
Examples
Input 1
36 2 3 99 100 105 100 101 100 95 100 100 99 100 105
Output 1
0.000
Note 1
Casting the spell at a height of 35, all water streams converge exactly at the point $(100, 100, 35)$, so the required energy is 0.
Input 2
10 9.8 3 0 0 0 0 1 0 100 0 0 50 0 1
Output 2
25.0000
Note 2
Casting the spell at a height of 10 (i.e., at the sprinkler level), the magic forms a right-angled triangle with vertices at $(0,0,10), (1,0,10), (0,50,10)$, with an area of 25.000, so the required magic energy is also 25.000.
Subtasks
For each test case, if the difference between your answer and the standard answer does not exceed 0.001, you will receive full marks for that test case; if the difference exceeds 0.001 but does not exceed 0.002, you will receive 50% of the marks; otherwise, you will receive 0 marks.
Constraints
For 20% of the data, $1 \le n \le 10$ For 50% of the data, $1 \le n \le 50$ For 100% of the data, $1 \le n \le 100$ $0 < h \le 10000.0$ $0 < g \le 100.0$ $0 \le x_i, y_i, x_i', y_i' \le 1000$
Note
The process of water being sprayed from the sprinkler to the ground can be viewed as projectile motion. Projectile motion can be decomposed into two components: horizontal and vertical.
Let $L = \sqrt{(x_i - x_i')^2 + (y_i - y_i')^2}$, then the initial velocity is $v_0 = L\sqrt{\frac{g}{2h}}$.
Horizontal velocity at time $t$: $v_{\text{horizontal}}(t) = v_0$ Vertical velocity at time $t$: $v_{\text{vertical}}(t) = gt$ Velocity at time $t$: $v(t) = \sqrt{v_{\text{horizontal}}^2(t) + v_{\text{vertical}}^2(t)}$