Run, bLue!

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

These days, bLue is reviewing for his "Basic Programming" course, so he always go back very late. Tonight, he passed through a streetlight.

Now, we know that the height of the streetlight is h1, the height of bLue is h2 and the initial distance between the streetlight and bLue is x.

bLue runs faster than all the reporters in the world. So he will be away from the streetlight in a speed with constant acceleration. Also we know he runs with an initial speed v0 and an accelerated speed a.

Now he want to know the length of his shadow after t seconds. Can you help him?


The input contains several test cases (no more than 100 cases), and terminates with EOF.

For each case:

  • The first line contains 5 real numbers h1, h2, x, v0, a (0 < h1, h2, x < 10^6, h2 < h1, 0 <= v0, a < 10^4)
  • The second line contains only one integer q (0 < q < 100), denoting the number of queries
  • Next there're q lines. For each line contains a real number t (0 <= t < 10^4), denoting the time t for a single query


For each query, output a real number in one line, indicating the answer.

Each value should be represented by 1 digit after the decimal point.

Sample Input

2 1 1 2 0

Sample Output



In your code, representing the mathematical expression as its simplest form is recommended.


【第八届山东理工大学ACM网络编程擂台赛 正式赛】Stone