#include <bits/stdc++.h>
using namespace std;
long long f[100010], c[100010], d[100010];
int x[100010];
int n, e, t, T;
inline void add1(int x, long long o) {
  while (x <= n) {
    c[x] = min(c[x], o);
    x += x & -x;
  }
}
inline long long ask1(int x) {
  long long nowans = 0x3f3f3f3f3f3f3f3fll;
  while (x) {
    nowans = min(nowans, c[x]);
    x -= x & -x;
  }
  return nowans;
}
inline void add2(int x, long long o) {
  while (x) {
    d[x] = min(d[x], o);
    x -= x & -x;
  }
}
inline long long ask2(int x) {
  long long nowans = 0x3f3f3f3f3f3f3f3fll;
  while (x <= n) {
    nowans = min(nowans, d[x]);
    x += x & -x;
  }
  return nowans;
}
int main() {
  scanf("%d%d%d", &n, &e, &t);
  T = t;
  if (t % 2) T++;
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  memset(f, 0x3f, sizeof(f));
  memset(c, 0x3f, sizeof(c));
  memset(d, 0x3f, sizeof(d));
  f[0] = 0;
  for (int i = 1; i <= n; i++) {
    f[i] = min(f[i], f[i - 1] + x[i] - x[i - 1] + t);
    int now = upper_bound(x + 1, x + 1 + i, x[i] - T / 2) - x;
    if (x[i] - T / 2 >= x[1]) {
      now--;
      long long nowans = ask1(now);
      f[i] = min(f[i], 3ll * x[i] + nowans);
    }
    if (x[i] - T / 2 < x[1]) now = 0;
    now++;
    long long nowans = ask2(i);
    f[i] = min(f[i], x[i] + nowans);
    add1(i, -3ll * x[i] + f[i - 1] + x[i] - x[i - 1]);
    add2(i, 0ll + t - x[i] + x[i] + f[i - 1] - x[i - 1]);
  }
  cout << f[n] + e - x[n];
}
