#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
pair<long long int, int> seg[4 * maxn];
int a[maxn];
long long int dp[2][maxn];
int n;
int e;
int d;
void update(int id, int l, int r, int l2, int r2, long long int val) {
  if (l >= r2 || r <= l2) {
    return;
  }
  if (l2 <= l && r <= r2) {
    if (seg[id].first == 0 || seg[id].first >= val) {
      seg[id] = {val, l2};
      return;
    }
  }
  int mid = (l + r) >> 1;
  update(id << 1, l, mid, l2, r2, val);
  update((id << 1) | 1, mid, r, l2, r2, val);
  seg[id] = min(seg[id << 1], seg[(id << 1) | 1]);
}
pair<long long int, int> get(int id, int l, int r, int l2, int r2) {
  if (l >= r2 || r <= l2) {
    return {(long long int)1e18, 1000};
  }
  if (l2 <= l && r <= r2) {
    return seg[id];
  }
  int mid = (l + r) >> 1;
  return min(get(id << 1, l, mid, l2, r2), get((id << 1) | 1, mid, r, l2, r2));
}
inline void input();
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  input();
}
inline void input() {
  cin >> n >> e >> d;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      dp[0][i] = a[i];
      dp[1][i] = a[i];
      dp[1][i] += d;
    } else {
      int l = 0;
      int r = i;
      while (l != r - 1) {
        int mid = (l + r) >> 1;
        if (2 * (a[i] - a[mid]) >= d) {
          l = mid;
        } else {
          r = mid;
        }
      }
      pair<long long int, int> p = get(1, 0, n, 0, l + 1);
      pair<long long int, int> w = get(1, 0, n, l, i);
      dp[0][i] = dp[1][i - 1] + (a[i] - a[i - 1]);
      if (2 * (a[i] - a[0]) >= d) {
        dp[1][i] = (dp[0][p.second] + 1ll * 3 * (a[i] - a[p.second]));
      }
      if (2 * (a[i] - a[i - 1]) < d) {
        dp[1][i] = min(dp[1][i], (long long)(dp[0][w.second] + d +
                                             1ll * 2 * (a[i] - a[w.second])));
      }
    }
    if (dp[1][i - 1] + a[i] - a[i - 1] + d <= dp[1][i]) {
      dp[1][i] = (long long)(dp[1][i - 1] + a[i] - a[i - 1] + d);
    }
    update(1, 0, n, i, i + 1, (long long)(dp[0][i] + (e - a[i])));
  }
  cout << dp[1][n - 1] + (e - a[n - 1]);
}
