4550. Leak

单点时限: 2.0 sec

内存限制: 512 MB

Renatus has a large cylindrical water storage tank.

The bottom area of the tank is $S$ square meters and the height is $H$ meters.

Now, there are $n$ taps on the side of the tank. The height of the $i$-th tap is $h_i$ and its water rate is $v_i$ cubic meters per second. This means that for the $i$-th tap, when the current water level of the tank is above $h_i$, the water in the tank will flow out of this tap at a rate of $v_i$ cubic meters per second, and when the current level of the tank is below $h_i$, no water will flow out of it.

Now you know the information of all the taps. The water level is $H$ at the beginning. How long does it take before the water level does not change anymore?

输入格式

In the first row, two positive integers $S,H$, the bottom area and height of the tank.

In the second row, an integer $n$ indicates the number of taps.

The next $n$ rows, each with two integers $h_i,v_i$, indicate the height of the $i$-th tap and its water rate, respectively.

It is guaranteed that $\forall 1<i\le n$, $h_{i-1} \ge h_i$.

Please pay attention to the data constraints.

输出格式

Output one line, a real number, indicating the answer.

Your answer will be considered correct if it is within $10^{-6}$ of the standard answer in absolute or relative terms.

样例

Input
5 10
3
6 2
4 1
0 1
Output
30.0000000000
Input
5 6
1
0 7
Output
4.2857142857

提示

$1\le S,H \le 10^4$

$0\le n \le 10^5$

$0\le h_i \le H$

$1\le v_i \le 10^4$

330 人解决,370 人已尝试。

339 份提交通过,共有 985 份提交。

1.9 EMB 奖励。

创建: 6 月,1 周前.

修改: 6 月,1 周前.

最后提交: 1 月,1 周前.

来源: N/A

题目标签