Rods

No attempts yetTime limit1sMemory limit128 MB

Problem

A laboratory at a certain company is testing a new material called politoksyparen. During the research an interesting property was discovered: a straight rod made of this material, when heated, lengthens and bends so that it turns into a circular arc whose chord is the rod's original straight shape (this property holds only for rods of very small diameter).

Suppose there are nn rods of very small diameter, where the ii-th rod has initial length lil_i (1li1000001 \le l_i \le 100\,000). When heated, each rod lengthens by did_i (1di1001 \le d_i \le 100, with dili/2d_i \le l_i / 2). Lengths are measured in millimeters.

Write a program that:

  • reads from standard input the number of rods nn and, for each rod, its length lil_i and its increase in length did_i;
  • for each rod, computes the distance between the midpoint of the chord and the midpoint of the arc after heating (assuming the rod really bends into a circular arc); the answer must be an integer that differs from the exact value by at most 0.50.5;
  • writes the results to standard output.

Input

The first line contains one positive integer nn (n50000n \le 50\,000). Each of the next nn lines contains two integers separated by a single space: the original length of the rod lil_i and its increase in length while heated did_i.

Output

Print nn lines, each containing one nonnegative integer. The integer on the ii-th line must equal the distance between the position of the midpoint of the ii-th rod before and after heating, computed to the required accuracy.