| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 512 MB | 34 | 8 | 8 | 29.630% |
Having stocked up with snowballs, Zenyk and Marichka already wanted to start a game.
But suddenly, Zenyk thought that throwing snowballs on a flat surface is boring. He wanted to build as high as possible hill for himself to climb at it and throw snowballs at Marichka.
Building of a hill isn’t easy. Zenyk treated it seriously, took a sheet of paper with coordinate axes, where y-axis is directed upwards, and began to draw the cross section of a hill (a front view).
Marichka doesn’t want the hill to be too high, so she imposed some constraints at its section.
Zenyk wants to know the maximum height he of a hill he can make under these constraints, and asks you the maximal y-coordinate of the hill’s section. Help him find it.
The first line contains four integers x0, y0, xn, yn (|x0|, |y0|, |xn|, |yn| ≤ 106) – coordinates of start and end of the chain.
The second line contains an integer n (1 ≤ n ≤ 105) — number of segments in the chain.
The third line contains n integers l1, . . . , ln (1 ≤ li ≤ 106) — lengths of the segments.
If there is no hill that satisfies these constraints, output “IMPOSSIBLE”.
Otherwise, output one real number — the maximum y-coordinate of the highest point. The answer will be considered correct if its absolute or relative error doesn’t exceed 10−7.
2 3 8 3 2 5 5
7.0000000000
4 7 44 77 4 4 7 7 4
IMPOSSIBLE