#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
const long long INF = (1ll << 60);
long long dp[MAXN + 5], a[MAXN + 5], T;
int que[MAXN + 5], s, t;
long long f1(int x) { return dp[x] - a[x] - 2 * a[x + 1]; }
long long f2(int x) { return T + 2 * a[x + 1]; }
int main() {
  int N, M;
  scanf("%d%d%lld", &N, &M, &T);
  for (int i = 1; i <= N; i++) scanf("%lld", &a[i]);
  a[N + 1] = M;
  long long p = INF;
  s = 1, t = 0;
  for (int i = 1; i <= N + 1; i++) {
    dp[i] = INF;
    while (s <= t && f1(que[t]) + f2(que[t]) >= f1(i - 1) + f2(i - 1)) t--;
    que[++t] = i - 1;
    while (s <= t && f2(que[s]) - 2 * a[i] <= 0) {
      p = min(p, f1(que[s]));
      s++;
    }
    dp[i] = min(p, f1(que[s]) + f2(que[s]) - 2 * a[i]) + 3 * a[i];
  }
  printf("%d\n", min(dp[N + 1], dp[N] + M - a[N]));
}
