Moving the Trees

No attempts yetTime limit1sMemory limit128 MB

Problem

A gardener at a large estate wants to plant trees along a straight road that runs from the entrance to the fountain. The road is $L$ meters long and $W$ meters wide.

The owner of the estate asked for trees to be planted on both sides of the road, following these rules:

  • The very first tree must sit at the start of the road (position $0$), and the last tree must sit at the end (position $L$).
  • The trees on the two sides must occupy exactly the same positions.
  • On each side, the gap between every pair of neighboring trees must be identical.

There are $N$ trees in total, so each side holds $N/2$ of them. By mistake, the gardener planted all of the trees on the left side only. The trees must now be moved so that the rules hold. Each tree travels in a straight line across the road plane, and the distance it covers is the Euclidean distance. Write a program that computes the minimum possible total distance the trees must be moved.

Input

The first line contains the number of trees $N$. $N$ is even and $4 \le N \le 2000$. The second line contains two integers $L$ and $W$ ($1 \le L \le 10000$, $1 \le W \le 20$). Each of the next $N$ lines contains one integer $p$, the position of a tree ($0 \le p \le L$).

Output

Print, on a single line, the minimum total distance the trees must be moved to satisfy the rules, rounded to six decimal places.