Hide

Problem Y
Expeditious Cubing

/problems/expeditiouscubing/file/statement/en/img-0001.jpg
The classic Rubik’s cube.
Picture by Keqs on Wikimedia Commons, cc-by sa
Your friend Claire has dragged you along to a speedcubing event that is happening in Eindhoven. These events are all about solving the Rubik’s cube and similar twisty puzzles as quickly as possible. The attendants of the event can enter into various competitions based on the type and size of the puzzle, and there are even special competitions where the puzzles need to be solved one-handed or blindfolded.

Claire is competing in the most popular competition: speedsolving the $3\times 3\times 3$ Rubik’s cube, pictured on the right. Each contestant needs to solve the cube five times, each time with a different random scramble. After all solves are completed, the best and the worst times are discarded and the final score is the average of the remaining three times. The contestant with the smallest final score wins.

Claire has done well in the competition so far and is among the contenders for the overall victory. All the other contestants have already finished their five solves, but Claire has one solve remaining. By looking at the final scores of the other contestants, she has deduced her own target final score. As long as her final score is less than or equal to this target score, she will be declared the overall winner. Is it possible for her to win the competition, and if so, what is the worst time she can have on her last solve in order to do so?

Input

The input consists of:

  • One line with four real numbers $t_1$, $t_2$, $t_3$ and $t_4$, the times Claire got on her first four solves.

  • One line with a real number $t$, Claire’s target final score, the worst final score she can have in order to be declared the overall winner.

Each number is between $1$ and $20$, inclusive, and is given with exactly two decimal places.

Output

If it is not possible for Claire to win the event, output “impossible”. If she will win regardless of the time she gets on her last solve, output “infinite”. Otherwise, output the worst time she can have on her last solve in order to be declared the overall winner. Output the number to exactly two decimal places.

Sample Input 1 Sample Output 1
6.38 7.20 6.95 8.11
7.53
infinite
Sample Input 2 Sample Output 2
6.38 7.20 6.95 8.11
6.99
6.82
Sample Input 3 Sample Output 3
6.38 7.20 6.95 8.11
6.45
impossible

Please log in to submit a solution to this problem

Log in