Under construction

Still being built. Things may change

Jumping Path

Time limit2sMemory limit1024 MB

Summary
Popeye walks along a line with n forbidden zones and may jump over each zone with a pole of length R, so find the minimum time from A to B.
Level

Medium6 of 10

Topics
Sorting, Greedy, Implementation, Math
Solved
No attempts yet

Statement

Popeye the Sailor loves to eat spinach. He also loves to smoke his corn-made pipe, and he smokes it constantly.

Popeye lives in the village of Sweethaven. The main street of Sweethaven is a straight line with nn public places, located at coordinates x1,x2,⋯ ,xnx_1, x_2, \cdots, x_n on that line.

Popeye needs to get from point AA on the main street to point BB. The Sweethaven authority has passed a law: smoking closer than rr to a public place is prohibited. Popeye has a pole of length R≥rR \ge r, so he can jump over the forbidden zones.

Popeye starts at point AA. He can walk from xx to yy in ∣x−y∣|x-y| time. At any time, he can use the pole to move from xx to x+2Rx+2R or x−2Rx-2R along a semicircle of radius RR, which takes πR\pi R time. At the end, Popeye must be at point BB, and no point on his trajectory can be closer than rr to any public place.

Input

The first line contains five integers nn, rr, RR, AA, and BB (1≤n≤5001 \le n \le 500, 1≤r≤R≤1061 \le r \le R \le 10^6, −109≤A,B≤109-10^9 \le A, B \le 10^9). The second line contains nn integers x1,x2,⋯ ,xnx_1, x_2, \cdots, x_n (−109≤xi≤109-10^9 \le x_i \le 10^9). All xix_i are pairwise distinct. Points AA and BB are different, and neither lies in a forbidden zone.

Output

Print one real number, the smallest time. The answer is accepted if its absolute or relative error is at most 10−610^{-6}. If it is impossible to get from AA to BB, print −1-1.

Hint

In the example from the statement, one of the optimal trajectories is shown below. The elapsed time is 8+15π8 + 15\pi.

Examples1

  1. Example 1

    Input
    5 2 5 3 9
    13 0 17 7 18
    
    Expected output
    55.1238898038