1474. Barrel

单点时限: 2.0 sec

内存限制: 256 MB

Some amount of water is poured into a barrel, then a number of cubes of different size and density are put into water. Finally, a lid is put onto the barrel and pushed down until it touches the edges of the barrel.

Write a program to compute the resulting water level in the barrel.

It can be assumed that:

the density of water is 1.0,

the influence of air can be neglected,

the cubes fit completely into the barrel,

the cubes do not rotate and do not touch each other.

输入格式

The first line of the input contains three real numbers — the bottom area of the barrel, S (0 < S ≤ 1000), the height of the barrel, H (0 < H ≤ 1000), and the volume of water, V (0 < V ≤ S*H). The next line contains the number of cubes, N (0 < N ≤ 1000). It is followed by N lines, each containing two real numbers describing a cube — the length of a side of the cube, L (0 < L ≤ 1000), and the density of the cube, D (0 < D ≤ 10).

输出格式

The first and only line of the output must contain one real number — the resulting water level. The output must not differ from the correct value by more than 10^-4.

样例

Input
100 10 500
1
1 0.5
Output
5.0050

0 人解决,1 人已尝试。

0 份提交通过,共有 1 份提交。

9.9 EMB 奖励。

创建: 16 年,10 月前.

修改: 6 年,9 月前.

最后提交: 1 年,8 月前.

来源: BOI 2003

题目标签