# Wilbur and Trees

Wilbur the pig really wants to be a beaver, so he decided today to pretend he is a beaver and bite at trees to cut them down.

There are n trees located at various positions on a line. Tree i is located at position x i. All the given positions of the trees are distinct.

The trees are equal, i.e. each tree has height h. Due to the wind, when a tree is cut down, it either falls left with probability p, or falls right with probability 1 - p. If a tree hits another tree while falling, that tree will fall in the same direction as the tree that hit it. A tree can hit another tree only if the distance between them is strictly less than h.

For example, imagine there are 4 trees located at positions 1, 3, 5 and 8, while h = 3 and the tree at position 1 falls right. It hits the tree at position 3 and it starts to fall too. In it’s turn it hits the tree at position 5 and it also starts to fall. The distance between 8 and 5 is exactly 3, so the tree at position 8 will not fall.

As long as there are still trees standing, Wilbur will select either the leftmost standing tree with probability 0.5 or the rightmost standing tree with probability 0.5. Selected tree is then cut down. If there is only one tree remaining, Wilbur always selects it. As the ground is covered with grass, Wilbur wants to know the expected total length of the ground covered with fallen trees after he cuts them all down because he is concerned about his grass-eating cow friends. Please help Wilbur.

Input

The first line of the input contains two integers, n (1 ≤ n ≤ 2000) and h (1 ≤ h ≤ 108) and a real number p (0 ≤ p ≤ 1), given with no more than six decimal places.

The second line of the input contains n integers, x 1, x 2, …, x n ( - 108 ≤ x i ≤ 108) in no particular order.

Output

Print a single real number — the expected total length of the ground covered by trees when they have all fallen down. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Examples

input

2 2 0.5000001 2

output

3.250000000

input

4 3 0.44 3 1 2

output

6.631200000

Note

Consider the first example, we have 2 trees with height 2.

There are 3 scenarios:

1. Both trees falls left. This can either happen with the right tree falling left first, which has  probability (also knocking down the left tree), or the left tree can fall left and then the right tree can fall left, which has  probability. Total probability is .

2. Both trees fall right. This is analogous to (1), so the probability of this happening is .

3. The left tree fall left and the right tree falls right. This is the only remaining scenario so it must have  probability.

Cases 1 and 2 lead to a total of 3 units of ground covered, while case 3 leads to a total of 4 units of ground covered. Thus, the expected value is .

Solution:

#include <bits/stdc++.h>

using namespace std;

const int N = 2010;

double f[N][N][2][2];
int x[N];
int lf[N], rg[N];

inline double get(int i, int j, int ti, int tj) {
return (i > j ? 0.0 : f[i][j][ti][tj]);
}

int main() {
int n, h;
double p;
cin >> n >> h >> p;
for (int i = 0; i < n; i++) {
cin >> x[i];
}
sort(x, x + n);
lf[0] = 0;
for (int i = 1; i < n; i++) {
if (x[i] - x[i - 1] < h) {
lf[i] = lf[i - 1];
} else {
lf[i] = i;
}
}
rg[n - 1] = n - 1;
for (int i = n - 2; i >= 0; i--) {
if (x[i + 1] - x[i] < h) {
rg[i] = rg[i + 1];
} else {
rg[i] = i;
}
}
for (int i = n - 1; i >= 0; i--) {
for (int j = i; j < n; j++) {
for (int ti = 0; ti < 2; ti++) {
for (int tj = 0; tj < 2; tj++) {
double res = 0.0;
if (i == j) {
{
int from = x[i] - h;
int to = x[i];
if (i > 0) {
from = max(from, ti == 0 ? x[i - 1] : x[i - 1] + h);
}
if (j < n - 1) {
to = min(to, tj == 1 ? x[j + 1] : x[j + 1] - h);
}
if (from < to) {
res += (to - from) * p;
}
}
{
int from = x[i];
int to = x[i] + h;
if (i > 0) {
from = max(from, ti == 0 ? x[i - 1] : x[i - 1] + h);
}
if (j < n - 1) {
to = min(to, tj == 1 ? x[j + 1] : x[j + 1] - h);
}
if (from < to) {
res += (to - from) * (1 - p);
}
}
} else {
{
int from = x[i] - h;
int to = x[i];
if (i > 0) {
from = max(from, ti == 0 ? x[i - 1] : x[i - 1] + h);
}
if (j < n - 1) {
to = min(to, tj == 1 ? x[j + 1] : x[j + 1] - h);
}
if (from < to) {
res += (to - from) * p;
}
res += f[i + 1][j][0][tj] * p;
}
{
int from = x[i];
int to = x[rg[i]] + h;
if (i > 0) {
from = max(from, ti == 0 ? x[i - 1] : x[i - 1] + h);
}
if (j < n - 1) {
to = min(to, tj == 1 ? x[j + 1] : x[j + 1] - h);
}
if (from < to) {
res += (to - from) * (1 - p);
}
res += get(rg[i] + 1, j, 1, tj) * (1 - p);
}
{
int from = x[j];
int to = x[j] + h;
if (i > 0) {
from = max(from, ti == 0 ? x[i - 1] : x[i - 1] + h);
}
if (j < n - 1) {
to = min(to, tj == 1 ? x[j + 1] : x[j + 1] - h);
}
if (from < to) {
res += (to - from) * (1 - p);
}
res += f[i][j - 1][ti][1] * (1 - p);
}
{
int from = x[lf[j]] - h;
int to = x[j];
if (i > 0) {
from = max(from, ti == 0 ? x[i - 1] : x[i - 1] + h);
}
if (j < n - 1) {
to = min(to, tj == 1 ? x[j + 1] : x[j + 1] - h);
}
if (from < to) {
res += (to - from) * p;
}
res += get(i, lf[j] - 1, ti, 0) * p;
}
res *= 0.5;
}
f[i][j][ti][tj] = res;
}
}
}
}
printf("%.17f\n", f[0][n - 1][0][0]);
return 0;
}