#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 500;
const long long INF = 1e18;
int head, tail, n, E, T, x[N], q[N];
long long f[N], g1[N], g2[N];
int main() {
  scanf("%d%d%d", &n, &E, &T);
  long long mi = INF;
  for (int i = 1; i <= n; i++) scanf("%d", x + i);
  int j = 0;
  g1[0] = -2 * x[1], g2[0] = T - x[1];
  int head = 1, tail = 1;
  q[1] = 0;
  for (int i = 1; i <= n; i++) {
    while (j < i && 2 * x[j + 1] <= 2 * x[i] - T) mi = min(mi, g1[j]), ++j;
    while (head <= tail && q[head] < j) ++head;
    f[i] = 3ll * x[i] + mi;
    if (head <= tail) f[i] = min(f[i], 2ll * x[i] + g2[q[head]]);
    g1[i] = f[i] - x[i] - 2 * x[i + 1];
    g2[i] = f[i] - x[i] - x[i + 1] + T;
    while (head <= tail && g2[i] <= g2[q[tail]]) --tail;
    q[++tail] = i;
  }
  cout << f[n] + E - x[n] << endl;
}
