#include <bits/stdc++.h>
using namespace std;
inline void gtmn(long long &a, long long b) {
  if (a > b) a = b;
}
inline void gtmx(long long &a, long long b) {
  if (a < b) a = b;
}
int a[100010];
long long coef[100010];
long long dp[100010];
int main(void) {
  memset(coef, 255, sizeof(coef));
  memset(dp, 127, sizeof(dp));
  dp[0] = 0;
  int n, e, t;
  scanf("%d%d%d", &n, &e, &t);
  a[0] = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    if (i) gtmx(coef[i], coef[i - 1]);
    if (~coef[i]) {
      gtmn(dp[i], 3ll * a[i] - coef[i]);
    }
    gtmn(dp[i + 1], dp[i] + a[i + 1] - a[i] + t);
    int l = i + 1, r = n + 1;
    while (l + 1 < r) {
      int md = (l + r) >> 1;
      if (((a[md] - a[i + 1]) << 1) <= t) {
        l = md;
      } else {
        r = md;
      }
    }
    if (l > i + 1 && l <= n) {
      gtmn(dp[l], 0ll + dp[i] + a[i + 1] - a[i] + (a[l] - a[i + 1]) * 2 +
                      max(t - a[l] + a[i + 1], a[l] - a[i + 1]));
    }
    ++l;
    if (l <= n) {
      gtmx(coef[l], 3ll * a[i] - dp[i] - a[i + 1] + a[i]);
    }
    if (l > i + 1 && l <= n) {
      gtmn(dp[l], 0ll + dp[i] + a[i + 1] - a[i] + (a[l] - a[i + 1]) * 2 +
                      max(t - a[l] + a[i + 1], a[l] - a[i + 1]));
    }
  }
  printf("%I64d\n", dp[n] + e - a[n]);
  return 0;
}
