Almost Free Falling

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Bob likes skydiving very much, so during his last internship at an IT company, he decided to live the experience of jumping from an aircraft and fall through the air before opening his parachute. But, before he imagined, he was already at the ground, everything happened so fast!

Now, he wants to know how much height he traveled through the air starting from the point where he jumped at some specific moments, and the total time he was falling.

We can describe this more formally: at time t=0t = 0, suppose that Bob is a point-mass with mass mm with initial position at the point where he jumped, with initial velocity zero (he jumped from rest) and with his parachute closed. Naturally, the gravity from the Earth will apply a downwards force equal to his weight, mgm \cdot g, where g=9.81,m/s2g = 9.81 \\, \text{m} / \text{s}^2. And to make it more realistic, in the period of time when he hasn't opened his parachute, the air will apply an upwards force (air resistance) equal to b_1v(t)b\_1 v(t), where b_1b\_1 is a given constant and v(t)v(t) is his instantaneous velocity. Then, at the moment when he opens his parachute at time t=t_1t = t\_1, that force will disappear and immediately a new upwards force equal to b_2v(t)b\_2 v(t) will appear, where b_2>b_1b\_2 > b\_1. That means that the effect of opening the parachute will apply more resistance to Bob's falling, or in other words, he will fall more slowly.

Help Bob with the task of calculating how much distance he has fallen at the moments he needs to know and the total time of falling. It is guaranteed that the parachute opens strictly before he has reached the ground (in other words, he doesn't die), and all the times in the queries are strictly less than the total time of falling.

입력

The first line contains five integers: mm (40m12040 \leq m \leq 120), b_1b\_1, b_2b\_2 (1b_1<b_21001 \leq b\_1 < b\_2 \leq 100), t_1t\_1 (90t_118090 \leq t\_1 \leq 180), and h_fh\_f (1h_f70,0001 \leq h\_f \leq 70\\,000), indicating Bob's mass in kilograms, the constant when the parachute is closed in Ns/m\text{N}\cdot\text{s} / \text{m}, the constant when the parachute is opened in Ns/m\text{N}\cdot\text{s} / \text{m}, the time when the parachute opens in seconds, and the total height from the starting point to the ground in meters, respectively. Recall that force is measured in Newtons, and 1,N=1,kgm/s21 \\, \text{N} = 1 \\, \text{kg} \cdot {m} / \text{s}^2.

The second line contains an integer qq (1q201 \leq q \leq 20), the number of queries from Bob.

Each of the following qq lines contains an integer t_it\_i in seconds, indicating a moment where Bob wants to know his traveled distance.

출력

Print qq lines: for each query, the distance traveled, in meters. And after that, print one line indicating the total time of falling, in seconds.

The absolute or relative error of the answers should not exceed 10410^{-4}.