Dancing with Baobabs
The Dance Shaman Nikiteofl leads a procession of dancing tribesmen, mentally preparing them for the intellectual ritual known as the "erudite-quartet."
Beginning at the point with coordinates (0, 0), Nikiteofl guides the procession northward, gradually turning east, moving clockwise along a quarter circle with a radius of 1. He then continues, moving clockwise through a quarter circle with a radius of 2, and similarly with radii 3, 4, and so forth (refer to the figure).
In the prairie where this dance occurs, there are n baobabs. For each baobab, determine the minimum distance from it to the dancing procession, assuming the dance continues indefinitely.
Input
The first line of the input contains a natural number n, which does not exceed 100000. Each of the following n lines contains two real numbers x_i and y_i, which do not exceed 10^6 in absolute value—these are the coordinates of the baobabs (the x axis points east, and the y axis points north). All coordinates are provided with no more than three decimal places.
Output
Output n lines, each showing the distance from a baobab to the dancing procession, with an absolute or relative precision of up to 10^{-6}.