Gheeves (plural of gheef) are some objects similar to funnels. We define a gheef as a two dimensional object specified by a sequence of points (p
1, p
2, ..., p
n) with the following conditions:
· 3 <= n <= 1000
· If a point p
i is specified by the coordinates (x
i, y
i), there is an index 1 < c < n such that y
1 > y
2 > ... > y
c and
y
c < y
c+1 < y
c+2 < ... < y
n. p
c is called the cusp of the gheef.
· For all 1 <= i < c, x
i < x
c and for all c < i <= n, x
i > x
c.
· For 1 < i < c, the amount of rotation required to rotate pi-1 around p
i in clockwise direction to become co-linear with pi and p
i+1, is greater than 180 degrees. Likewise, for c < i < n, the amount of rotation required to rotate
p
i-1 around p
i in clockwise rotation to become co-linear with pi and p
i+1, is greater than 180 degrees.
· The set of segments joining two consecutive points of the sequence intersect only in their endpoints.
For example, the following figure shows a gheef of six points with c = 4:
We call the sequence of segments (p
1p
2, p
2p
3, ..., p
n-1p
n), the body of the gheef. In this problem, we are given two gheeves P = (p
1, p
2, ..., p
n) and Q = (q
1, q
2, ..., q
m), such that all x coordinates of p
i are negative integers and all x coordinates of q
i are positive integers. Assuming the cusps of the two gheeves are connected with a narrow pipe, we pour a certain amount of water inside the gheeves. As we pour water, the gheeves are filled upwards according to known physical laws (the level of water in two gheeves remains the same). Note that in the gheef P, if the level of water reaches min(y
1, y
n), the water pours out of the gheef (the same is true for the gheef Q). Your program must determine the level of water in the two gheeves after pouring a certain amount of water. Since we have defined our problem in two dimensions, the amount of water is measured in terms of area it fills. Note that the volume of pipe connecting cusps is considered as zero.