Arsenic & Cyanide Mining (ACM) is a corporation that has recently decided to start developing mines in the lands near your hometown. As a member of the citizens' regulatory committee for ACM's operations, your task is to control how much the corporation can mine from those lands, so that you keep the jobs and other benefits without sacrificing the environment or the health of the local residents.
ACM plans to mine several rectangular patches of land. A patch has width $W$, can be dug down to a maximum depth $D$, and has a flat surface which we consider to be at depth $0$. The minerals in a patch are organized in three layers, which may vary in depth along the width of the patch but always keep the same profile along its whole length. This is why ACM cares only about the profile along the width of each patch, and has performed exploratory work to determine its shape precisely. The two interfaces between the three layers can be described by two functions $y_1(x)$ and $y_2(x)$: the first is the boundary between the top layer and the middle layer, and the second is the boundary between the middle layer and the bottom layer. These functions always satisfy
$$-D < y_2(x) < y_1(x) < 0 \qquad \text{for } 0 \le x \le W,$$
so the layer boundaries never touch. Each function has the form $y_i(x) = p_i(x)/q_i(x)$, where
$$p_i(x) = \sum_{k=0}^{K} P_{i,k}, x^{k} \qquad \text{and} \qquad q_i(x) = \sum_{k=0}^{K} Q_{i,k}, x^{k},$$
for $i = 1, 2$ and a certain integer $K$. Two example patches are described in the table below.
| Example patch | Layer interfaces |
|---|---|
| $W = 6$, $D = 9$ | $y_1(x) = \dfrac{-10 + x}{2}$, $\quad y_2(x) = \dfrac{-16 + x}{2}$ |
| $W = 8$, $D = 10$ | $y_1(x) = \dfrac{-1392 + 864x - 216x^2 + 24x^3 - x^4}{1312 - 864x + 216x^2 - 24x^3 + x^4}$, $\quad y_2(x) = \dfrac{-73 + 36x - 54x^2 + 36x^3 - 9x^4}{17 - 4x + 6x^2 - 4x^3 + x^4}$ |
ACM digs everything in a patch down to a certain digging depth $d$ and sells all the extracted minerals. However, the minerals in the top and bottom layers are essentially worthless, so the profit comes exclusively from the middle layer. In fact, the profit is proportional to the area $A$ of the part of the middle layer that lies at depth at most $d$ in the profile. Given the description of a patch and an integer $A$, determine the digging depth $d$ you should allow so that ACM obtains an area of the middle layer in the profile equal to exactly $A$. For the first example patch, obtaining area $A = 4$ requires digging depth $d = 4.00000$; for the second example patch, obtaining area $A = 14$ requires digging depth $d = 5.51389$.
Each test case is described by five lines. The first line contains four integers $W$, $D$, $A$ and $K$, where $W$ is the width of the patch ($1 \le W \le 8$), $D$ is its depth ($1 \le D \le 10$), $A$ is the required area of the middle layer in the profile ($1 \le A \le W \times D$), and $K$ defines the interfaces $y_1(x)$ and $y_2(x)$ as explained above ($0 \le K \le 8$). Each of the next four lines contains $K + 1$ integers between $-10^{8}$ and $10^{8}$, inclusive. The second line gives the coefficients of $p_1(x)$ from $P_{1,0}$ to $P_{1,K}$; the third line gives the coefficients of $q_1(x)$ from $Q_{1,0}$ to $Q_{1,K}$; the fourth line gives the coefficients of $p_2(x)$ from $P_{2,0}$ to $P_{2,K}$; the fifth line gives the coefficients of $q_2(x)$ from $Q_{2,0}$ to $Q_{2,K}$.
The input contains several test cases; read until the end of input. Within each test case $A$ is strictly less than the total area of the middle layer in the profile, and there is a single value $d$ whose digging depth yields an area of exactly $A$. Moreover, $q_1(x) \ne 0$, $q_2(x) \ne 0$, and $-D < y_2(x) < y_1(x) < 0$ for $0 \le x \le W$.
For each test case, output one line with the digging depth $d$ that ACM should be allowed so that it obtains an area of exactly $A$ from the middle layer in the profile. Print $d$ as a decimal number with exactly five digits after the decimal point, rounded if necessary.