PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000409. Giải Rubik tốc độ (Expeditious Cubing)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Giải Rubik tốc độ (Expeditious Cubing)

Expeditious Cubing

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

Claire competes in timed solving of the 3×3×33\times3\times3 Rubik's cube. Each contestant completes five solves. Once all five are completed, one fastest and one slowest time are discarded. The score is the mean of the remaining three times; a smaller score is better.

Claire's first four solve times are t1,t2,t3,t4t_1,t_2,t_3,t_4 seconds. From the other contestants' results, she knows a target score tt: she wins if her score is at most tt.

Determine whether Claire can still win. If she can, find the largest time she may spend on her last solve while still winning. If she wins regardless of the last solve time, report that instead.

Input

The first line contains four real numbers t1,t2,t3,t4t_1,t_2,t_3,t_4, the first four solve times in seconds.

The second line contains the real number tt, the target score in seconds.

Output

Print exactly one line:

  • impossible if Claire cannot win.
  • infinite if Claire wins regardless of her final solve time.
  • Otherwise, print the maximum last solve time that still allows Claire to win, with exactly two digits after the decimal point.

Subtasks

  • Subtask 1 (20 points): 1≤ti≤201\le t_i\le20 (1≤i≤41\le i\le4); 1≤t≤201\le t\le20; all five numbers have exactly two decimal digits; t1=t2=t3=t4t_1=t_2=t_3=t_4.
  • Subtask 2 (30 points): 1≤ti≤201\le t_i\le20 (1≤i≤41\le i\le4); 1≤t≤201\le t\le20; all five numbers have exactly two decimal digits; the four times tit_i contain at most two distinct values.
  • Subtask 3 (50 points): 1≤ti≤201\le t_i\le20 (1≤i≤41\le i\le4); 1≤t≤201\le t\le20; all five numbers have exactly two decimal digits.

Examples

Input

6.38 7.20 6.95 8.11
7.53

Output

infinite

Explanation

Sorted times are 6.38,6.95,7.20,8.116.38,6.95,7.20,8.11. A last time of at least 8.118.11 yields (6.95+7.20+8.11)/3=7.42≤7.53(6.95+7.20+8.11)/3=7.42\le7.53. A smaller last time cannot increase the score, so Claire always wins.

Input

6.38 7.20 6.95 8.11
6.99

Output

6.82

Explanation

At 6.826.82, discard 6.386.38 and 8.118.11. The remaining times sum to 6.82+6.95+7.20=20.976.82+6.95+7.20=20.97, giving mean 6.996.99. A larger final time below 8.118.11 increases that sum, and a time at least 8.118.11 gives 7.427.42. No larger time can win.

Input

6.38 7.20 6.95 8.11
6.45

Output

impossible

Explanation

Even with a final time at most 6.386.38, the retained times are 6.38,6.95,7.206.38,6.95,7.20. The minimum possible score is 20.53/3≈6.84333>6.4520.53/3\approx6.84333>6.45, so winning is impossible.