Sunlight

Compute sunlight hours for each rooftop from the sky angles blocked by taller buildings on both sides.

Medium7StackGeometryMathNo attempts yetTime limit4sMemory limit256 MB

Problem

Roman tenancy law recognized a right to sunlight for every resident, whatever their status. Many of the health benefits of good sun exposure were already known back then.

A city plan reviewer therefore starts by measuring how the proposed buildings divide that resource. An avenue runs from west to east and carries NN buildings. The ii-th building from the west stands at position XiX_i, is HiH_i meters tall, and is infinitesimally thin.

The sky covers 180 degrees, from the western horizon to the eastern horizon, and the sun crosses those 180 degrees at a constant rate over 12 hours. Look at the sky from the top of building ii, the point (Xi,Hi)(X_i, H_i). Another building jj hides the sky from the horizon on its own side up to the direction of its top (Xj,Hj)(X_j, H_j). If that direction points below the horizontal, building jj hides no sky at all. When AA degrees of sky are left uncovered, the top of building ii is in sunlight for 12A/18012A/180 hours.

Find how long the top of each building is in sunlight.

Input

The first line contains the number of buildings NN (1N2×1051 \le N \le 2 \times 10^5).

Each of the next NN lines contains two integers XiX_i and HiH_i (1Xi,Hi1091 \le X_i, H_i \le 10^9), the position and the height of one building in meters. The buildings are listed from west to east, so X1<X2<<XNX_1 < X_2 < \cdots < X_N.

Output

Print NN lines. On the ii-th line, print how many hours the top of the ii-th building is in sunlight, rounded to six decimal places.