#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101010;
int N, E, T;
int x[MAXN];
long long f[MAXN];
int head = 1, tail = 0;
long long maxn = 1000000000000ll;
int q[MAXN];
long long t[MAXN];
void push(int p, long long now) {
  while (head <= tail && now <= t[tail]) tail--;
  q[++tail] = p;
  t[tail] = now;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> E >> T;
  for (int i = 1; i <= N; ++i) cin >> x[i];
  f[N] = E + T - x[N];
  x[N + 1] = E;
  push(N, f[N + 1] + x[N]);
  for (int i = N - 1; i >= 1; --i) {
    while (head <= tail && 2 * (x[q[head]] - x[i]) >= T) {
      maxn = min(maxn, f[q[head] + 1] + 2ll * x[q[head]] + x[q[head] + 1]);
      head++;
    }
    f[i] = maxn - 3ll * x[i];
    f[i] = min(f[i], f[i + 1] + T + x[i + 1] - x[i]);
    if (head <= tail) f[i] = min(f[i], t[head] + T - x[i]);
    push(i, f[i + 1] + x[i]);
  }
  cout << f[1] + x[1] << endl;
  return 0;
}
