#include <bits/stdc++.h>   using namespace std;   const int maxn = 2015;   const int inf = 1 << 29;   int n, h, a[maxn], l[maxn], r[maxn];   double p, dp[maxn][maxn][2][2];   int main() {     cin >> n >> h >> p;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     for (int i = 0; i < n; i++) {       int lb = i - 1;       for (; lb >= 0 && a[lb + 1] - a[lb] < h; lb--)         ;       l[i] = lb;       int rb = i + 1;       for (; rb < n && a[rb] - a[rb - 1] < h; rb++)         ;       r[i] = rb;     }     for (int len = 1; len <= n; len++) {       for (int leftFall = 0; leftFall < 2; leftFall++) {         for (int rightFall = 0; rightFall < 2; rightFall++) {           for (int start = 0; start + len - 1 < n; start++) {             int end = start + len - 1;             if (leftFall == 0) {               int tmp = -inf;               if (start > 0) {                 tmp = a[start - 1];               }               dp[start][end][leftFall][rightFall] +=                   0.5 * p *                   (min(h, a[start] - tmp) + dp[start + 1][end][0][rightFall]);             } else {               int tmp = -inf;               if (start > 0) {                 tmp = a[start - 1] + h;               }               dp[start][end][leftFall][rightFall] +=                   0.5 * p *                   (min(h, a[start] - tmp) + dp[start + 1][end][0][rightFall]);             }             if (rightFall == 1) {               int tmp = inf;               if (end < n - 1) {                 tmp = a[end + 1];               }               dp[start][end][leftFall][rightFall] +=                   0.5 * (1 - p) *                   (min(h, tmp - a[end]) + dp[start][end - 1][leftFall][1]);             } else {               int tmp = inf;               if (end < n - 1) {                 tmp = a[end + 1] - h;               }               dp[start][end][leftFall][rightFall] +=                   0.5 * (1 - p) *                   (min(h, tmp - a[end]) + dp[start][end - 1][leftFall][1]);             }             if (end < r[start]) {               dp[start][end][leftFall][rightFall] +=                   0.5 * (1 - p) * (a[end] - a[start]);               if (rightFall == 1) {                 int tmp = inf;                 if (end < n - 1) {                   tmp = a[end + 1];                 }                 dp[start][end][leftFall][rightFall] +=                     0.5 * (1 - p) * min(h, tmp - a[end]);               } else {                 int tmp = inf;                 if (end < n - 1) {                   tmp = a[end + 1] - h;                 }                 dp[start][end][leftFall][rightFall] +=                     0.5 * (1 - p) * min(h, tmp - a[end]);               }             } else {               dp[start][end][leftFall][rightFall] +=                   0.5 * (1 - p) *                   (a[r[start] - 1] - a[start] + h +                    dp[r[start]][end][1][rightFall]);             }             if (l[end] < start) {               dp[start][end][leftFall][rightFall] +=                   0.5 * p * (a[end] - a[start]);               if (leftFall == 0) {                 int tmp = -inf;                 if (start > 0) {                   tmp = a[start - 1];                 }                 dp[start][end][leftFall][rightFall] +=                     0.5 * p * min(h, a[start] - tmp);               } else {                 int tmp = -inf;                 if (start > 0) {                   tmp = a[start - 1] + h;                 }                 dp[start][end][leftFall][rightFall] +=                     0.5 * p * min(h, a[start] - tmp);               }             } else {               dp[start][end][leftFall][rightFall] +=                   0.5 * p *                   (a[end] - a[l[end] + 1] + h + dp[start][l[end]][leftFall][0]);             }           }         }       }     }     cout << setprecision(9) << fixed << dp[0][n - 1][0][0] <<   n ;     return 0;   }