Hide

Problem H
A Night To Remember

Languages en is
/problems/hi.anighttoremember/file/statement/en/img-0001.png
Image taken from commons.wikimedia.org
There are fun times ahead for ICPS (Icelandic Competitive Programming Society). ICPS is planning to hold a big party. First thing to prepare is to order some food. As often before it is agreed to order some pizza from Trominos. They look up the waiting time and see that they offer a forecast for how long the waiting time will be as a function of when you order. If an order is placed at time $t$ then the waiting time is given by \[ f(t) = (t - a)^6 + (t - b)^4 + (t - c)^2 + d \]

where $a, b, c, d$ are coefficients that change from day to day. This poses a problem as there is an agreement that the pizza should be ready at time $T$, so when should it be ordered? Despite having decent resources ICPS can not place an order in the past. The decision to order pizza was made at time $t = 0$.

Input

The first line of the input contains one floating point number $0 \leq T \leq 10^9$ which has at most six digits after the decimal. This is the time that ICPS wants the pizza to be ready at. The next line contains four floating point numbers $0 \leq a, b, c, d \leq 10^3$ which also have at most six digits after the decimal. These coefficients determine the waiting time function as given above.

Output

If there exists no time $t$ such that the pizza is ready at time $T$, print ‘O nei!’. Otherwise print one line with the number $t$, the time such that if an order is placed at time $t$ it is ready at time $T$. If there is more than one such time $t$, print the smallest positive valid $t$. An answer is correct if its relative or absolute error is smaller than $10^{-6}$.

Sample Input 1 Sample Output 1
2.0
0.0 0.0 0.0 1.0
0.5591153088522895
Sample Input 2 Sample Output 2
2.0
2.0 1.0 1.0 1.0
O nei!

Please log in to submit a solution to this problem

Log in