## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] Pebbles and Beads Codeforces Solution

time limit per test
4 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

There are two currencies: pebbles and beads. Initially you have $a$ pebbles, $b$ beads.

There are $n$ days, each day you can exchange one currency for another at some exchange rate.

On day $i$, you can exchange $-{p}_{i}\le x\le {p}_{i}$ pebbles for $-{q}_{i}\le y\le {q}_{i}$ beads or vice versa. It's allowed not to perform an exchange at all. Meanwhile, if you perform an exchange, the proportion $x\cdot {q}_{i}=-y\cdot {p}_{i}$ must be fulfilled. Fractional exchanges are allowed.

You can perform no more than one such exchange in one day. The numbers of pebbles and beads you have must always remain non-negative.

Please solve the following $n$ problems independently: for each day $i$, output the maximum number of pebbles that you can have at the end of day $i$ if you perform exchanges optimally.

Input

The first line of the input contains a single integer $t$ ($1\le t\le {10}^{3}$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$$a$ and $b$ ($1\le n\le 300\phantom{\rule{thinmathspace}{0ex}}000$$0\le a,b\le {10}^{9}$) — the number of days and the initial number of pebbles and beads respectively.

The second line of each test case contains $n$ integers: ${p}_{1},{p}_{2},\dots ,{p}_{n}$ ($1\le {p}_{i}\le {10}^{9}$).

The third line of each test case contains $n$ integers: ${q}_{1},{q}_{2},\dots ,{q}_{n}$ ($1\le {q}_{i}\le {10}^{9}$).

It is guaranteed that the sum of $n$ over all test cases doesn't exceed $300\phantom{\rule{thinmathspace}{0ex}}000$.

Output

Output $n$ numbers — the maximum number of pebbles at the end of each day.

Your answer is considered correct if its absolute or relative error does not exceed ${10}^{-6}$.

Formally, let your answer be $a$, and the jury's answer be $b$. Your answer is accepted if and only if $\frac{|a-b|}{max\left(1,|b|\right)}\le {10}^{-6}$.