beecrowd | 3352

# Run away with me, Galileo!

By Gabriel Batista Galli, Mendelics Brazil

Timelimit: 2

One of the big fields of research at the University of the South is Computational Astrophysics. In the most recent group assignment, it is asked to unravel the mysteries of a letter not known by many, by thankfully preserved by the History Museum of the university:

“April 27th, 1597

Dear Galileo,

I've been studying some papers of Nicolaus Copernicus for a long time already and I've found a pretty interesting side note in the last pages of his De revolutionibus orbium coelestium. He wrote:

There's a huge number of exotic celestial bodies orbiting the Sun, just like the Earth does, and we are in a constant threat of imminent collision. Such event could eradicate every living being in our planet!

After reading such words, I started trying to figure out how to estimate the position of the planets along time. And I managed to find some formulae that can help! But no one believes the heliocentric model, so I'm sure no one's gonna trust any of this too. But I know you believe. You are the only one that can help me now, Galileo.

Initially, it could appear that every planet moves along a circular orbit around the Sun. But as math shows us, our star is actually one of the foci of the elliptical orbit these bodies describe (don't worry, how to calculate these angular anomalies is part of my discovery). Thus, I named perihelion the closest point an object gets to Sun and aphelion the farthest. Knowing these two coordinates and the orbital period of those bodies, we can follow these formulae and approximate their position after a given time since perihelion! There's a lot of math to do here, but I know you're good at it and together we can make it work!

First, we'll need the mean anomaly M = n × t of the body, where t is the number of days since perihelion and n is its mean motion, given by n = 2π / o. Here, o is the orbital period, also in days, of the celestial body. Second, we need to solve an equation that I've kindly given my name to (I am actually having a lot of trouble solving this one!): M = Ee × sin E, where E is the eccentric anomaly and e is the eccentricity of the orbit. M is a parameterization of time and E a parameterization of polar angle. These anomalies relate to where the body would be if it had a perfectly circular orbit (very eccentric, indeed)...

Regardless, now we just have to find the distance r = a × (1 − e × cos E) from the body to the Sun, a being the semi-major axis of the orbit, and the true anomaly θ of the body in order to get to its polar coordinate (r, θ) with respect to Sun. For the true anomaly, we have cos θ = (cos Ee) / (1 − e × cos E) and sin θ = (sin E × √(1 − e2)) / (1 − e × cos E).

Well... we finally know the polar coordinates of every planet around our star and of a potentially catastrophic celestial body. What we wanna know is if that body is currently inside or on the boundary of a triangle formed by any other three bodies of our Solar System. The Sun and some of our planets are so massive they can alter the orbit of the body and make it come directly to us, if it wasn't already (or eject it outta here, but who knows?). So if it is close enough, we are undoubtedly lost!

I am so worried, Galileo... I don't want this to be the end of our road! What can we do, if that is what this harmonically chaotic Mundi wants? If the worst happens, would you spend some of your last minutes with me?

With love, from the always yours,
Kepler”

## Input

Several lines make up a test case. The first one has an integer k representing the number of planets (2 ≤ k ≤ 105). The following k lines contain the description of each planet: four floating point numbers corresponding to the distance of perihelion dph and aphelion dap in kilometers from the Sun, orbital period o in days and the time t since the last perihelion, also in days (0 < dphdap ≤ 1010; 0 < o ≤ 105; 0 ≤ t < o), respectively. The last line contains the description of the feared celestial body, in the same format as a planet. Consider all objects in the input to be coplanar. Every floating point number will have at most 8 decimal places.

## Output

The output should be a single line containing “Certus, Kepler!” if Kepler and Galileo spent their last minutes together or “Harmonicus nihilominus!” otherwise (without the quotes).

 Input Sample Output Sample 9 46001272.0 69817079.0 87.96926 14.2 107476000.0 108941850.0 224.7008 47.98 147098074.0 152097701.0 365.25636 115.23 206644545.0 249228730.0 686.97959 421.444449 740742600.0 816081460.0 4332.8201 2.1024 1349467000.0 1503983000.0 10755.699 10075 2735555030.0 3006389400.0 30687.153 27699.43434343 4459631500.0 4536874300.0 60190.03 60190 4420000000.0 7375927900.0 90553.017 73117.017 87661080.0 5248238950.0 27509.1291 0 Certus, Kepler!