| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 1 | 1 | 1 | 100.000% |
Popeye the Sailor loves to eat spinach. He also loves to smoke his corn-made pipe. And which he constantly smokes.
Popeye lives in the Sweethaven village. On the main street of Sweethaven, which can be represented as a straight line, there are $n$ public places, which can be considered as points on a straight line located at coordinates $x_1, x_2, \cdots , x_n,ドル respectively.
Popeye needs to get from the $A$ point on the main street to the $B$ point. Everything would have been simple, if not for the law that passed Sweethaven's authority: now smoking nearer than $r$ from a public place is prohibited. Fortunately, Popeye has a pole length $R \ge r,,ドル with which he can jump over forbidden zones.
Popeye is initially located at point $A$. He can move from $x$ to $y$ on foot in $|x-y|$ time. Also, at any time, he can use the pole and move from point $x$ to point $x+2R$ or $ x-2R,ドル moving along a semicircle of radius $R,ドル while he spends $\pi R$ time. At the end of the path, Popeye must be at point $B,ドル and at no point on the trajectory of Popeye can be closer than $r$ to any public place.
Determine the shortest time it takes Popeye to get from $A$ to $B$. Or determine that it is impossible to get from $A$ to $B$ under the given constraints, so Popeye will have to use the power of spinach.
The first line contains five integers $n,ドル $r,ドル $R,ドル $A$ and $B$ (1ドル \le n \le 500,ドル 1ドル \le r \le R \le 10^6,ドル $-10^9 \le A, B \le 10^9$). The second line contains $n$ integers $x_1, x_2, \cdots , x_n$ ($-10^9 \le x_i \le 10^9,ドル 1ドル \le i \le n$). All $x_i$ are pairwise distinct. It is guaranteed that the points $A$ and $B$ are different and are not located in any of the forbidden zones.
Print one real number --- the smallest time. The answer will be counted if it differs from the jury's answer by no more than 10ドル^{-6}$ in absolute or relative value. If it is impossible to get from $A$ to $B,ドル print $-1$.
5 2 5 3 9 13 0 17 7 18
55.1238898038
For an example from the statement, one of the optimal trajectories of movement looks as follows:
Elapsed time --- 8ドル + 15\pi$.