#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 3;
const long long inf = 1e16;
int n, e, t;
int x[N];
long long cost(int l, int r) {
  long long res = 0;
  long long val = x[r] - x[l];
  res += val + max(0LL, t - 2LL * val);
  res += val;
  return res;
}
long long dp[N][N];
long long solve(int pos, int last) {
  if (pos > n) {
    if (last == n) {
      return 0;
    }
    return inf;
  }
  if (dp[pos][last] != -1) {
    return dp[pos][last];
  }
  long long res = inf;
  res = min(res, solve(pos + 1, last) + x[pos + 1] - x[pos]);
  res =
      min(res, cost(last + 1, pos) + solve(pos + 1, pos) + x[pos + 1] - x[pos]);
  return dp[pos][last] = res;
}
int main() {
  scanf("%d %d %d", &n, &e, &t);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", x + i);
  }
  x[0] = 0;
  x[n + 1] = e;
  memset(dp, -1, sizeof(dp));
  printf("%lld\n", solve(1, 0) + x[1]);
}
