Under construction

Still being built. Things may change

Defying Gravity

Time limit2sMemory limit512 MB

Summary
Given n point masses around the origin, list every line through the origin that avoids all satellites and keeps the total force radial along the whole path.
Level

Medium7 of 10

Topics
String matching, Geometry, Math
Solved
No attempts yet

Problem

Planet Oz is located at the origin of the two-dimensional Euclidean plane. Elphaba wants to show everyone that her powers lie far beyond the laws of physics. To do this, she wants to take off from Oz and fly away along some straight line to infinity and beyond.

Oz has nn satellites revolving around it. For each satellite, its polar coordinates (ρi;φi)(\rho_i; \varphi_i) and mass mim_i are known. Here, the planet and satellites are treated as points. ρi\rho_i is the radial distance from Oz to the ii-th satellite, and φi\varphi_i is the polar angle between the satellite and a fixed reference direction, measured in arc seconds.

Elphaba is at the point r⃗\vec{r} and has mass mm. The ii-th satellite is at the point r⃗i\vec{r}_i. The satellite attracts Elphaba with a force directed from Elphaba toward the satellite. The force is proportional to Elphaba's mass mm and the satellite's mass mim_i, and inversely proportional to the squared distance ∣r⃗−r⃗i∣2|\vec{r} - \vec{r}_i|^2 between them. The exact force F⃗i\vec{F}_i that the ii-th satellite applies to Elphaba is:

F⃗i=−Gmmi(r⃗−r⃗i)∣r⃗−r⃗i∣3\vec{F}_i = - \frac{G m m_i (\vec{r} - \vec{r}_i)}{|\vec{r} - \vec{r}_i|^3}

Here, GG is the universal gravitational constant, whose value does not matter for this problem.

Forces from different satellites add up directly. The total force on Elphaba is F⃗=F⃗1+⋯+F⃗n\vec{F} = \vec{F}_1 + \cdots + \vec{F}_n.

Elphaba wants a flight direction that does not pass through any satellite and is not changed by the satellites at any moment. In other words, the force F⃗\vec{F} must be collinear with r⃗\vec{r} at every point r⃗\vec{r} on her trajectory.

Find all possible directions for Elphaba's flight.

Input

The first line contains a single integer nn (2≤n≤2⋅1052 \le n \le 2 \cdot 10^5), the number of satellites.

Each of the following nn lines contains three integers ρi\rho_i, φi\varphi_i, and mim_i (1≤ρi≤10181 \le \rho_i \le 10^{18}, 0≤φi<1296000 \le \varphi_i < 129600, 1≤mi≤1091 \le m_i \le 10^9), the polar coordinates and mass of the ii-th satellite.

It is guaranteed that no two satellites have the same polar angle φ\varphi.

Output

Output a sorted list of real numbers α\alpha (0≤α<1296000 \le \alpha < 129600) denoting the polar angles, in arc seconds, of all possible flight directions. An answer is correct if the absolute or relative error of every number is at most 10−610^{-6}. The answer always contains at most 2⋅1052 \cdot 10^5 directions.

Hint

One arc second (written 1′′) is one sixtieth of one arc minute (1′), and one arc minute is one sixtieth of one degree (1°). So 60′′=1′60'' = 1', 60′=1∘60' = 1^\circ, and 129600′′=360∘129600'' = 360^\circ, meaning 129600 arc seconds make a full turn.

In the first example, the first satellite is at A(1; 0) and the second is at B(−1; 0). The only possible flight directions in the picture are the ones with polar angles 90° = 32400'' and 270° = 97200''.

Examples2

  1. Example 1

    Input
    2
    1 0 1
    1 64800 1
    
    Expected output
    2
    32400.0000000
    97200.0000000
    
  2. Example 2

    Input
    3
    1 0 1
    1 1 1
    1 2 1
    
    Expected output
    1
    64801.0000000