Clock

Time limit2sMemory limit128 MB

Problem

A celebrated architect is designing a monumental clock that displays the time elapsed since the beginning of the universe.

The clock has $n$ hands that turn at constant speeds, numbered from $1$ to $n$, fastest to slowest. Hand $1$ completes one full revolution every minute ($60$ seconds). Each hand turns slower than the one before it: while hand $i$ makes $d_i$ full revolutions, hand $i+1$ makes exactly one.

To set the clock you grab a hand by the handle at its tip and turn it either way. Turning a hand drags every slower hand along in proportion to its usual speed, while every faster hand stays still. The hands are enormous, so the effort spent equals the total distance travelled by the handles you grab.

Consider three hands — a second hand, a minute hand, and an hour hand of lengths $5$, $15$, and $10$ meters. To set the clock from 2:30 to 6:00 (see the figure) the cheapest way is to turn the minute hand $180°$ clockwise and then the hour hand $90°$ clockwise; the handles travel a total of about $62.83$ meters.

Setting the clock from 2:30 to 6:00.

Find a way to set the clock that minimizes the total distance the handles travel.

Input

The first line contains one integer $n$ — the number of hands ($0 < n \le 50$).

The second line contains $n-1$ integers $d_1, d_2, \ldots, d_{n-1}$ ($2 \le d_i \le 10^6$); when $n = 1$ this line is empty.

The third line contains $n$ integers $l_1, l_2, \ldots, l_n$ ($1 \le l_i \le 10^6$) — the lengths of the hands.

The next two lines each contain one non-negative integer: the time the clock currently shows and the time it must be set to. Both times are measured in seconds and are less than $2^{63}$.

Output

Turning a hand of length $l$ through one full revolution moves its handle a distance of $2\pi l$, so the minimal total distance is always $2\pi Q$ for a rational number $Q$ — the sum, over all hands, of a hand's length multiplied by the number of revolutions it is turned.

Output $Q$ as a reduced fraction p/q with $q > 0$ and $\gcd(|p|, q) = 1$ (print 0/1 when no hand has to move).

In the example above the minimal distance is $20\pi = 2\pi \cdot 10$, so the answer is 10/1.