#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 202000;
const long long inf = 1e16;
int n, a[N], T;
long long f[N];
int main() {
  read(n);
  read(a[n + 1]);
  read(T);
  for (register int i = (1); i <= (n); i++) read(a[i]);
  for (register int i = (n); i >= (1); i--) {
    f[i] = inf;
    for (register int j = (i + 1); j <= (n + 1); j++)
      umin(f[i], f[j] + 2 * (a[j - 1] - a[i]) + a[j] - a[i] +
                     max(0, T - 2 * (a[j - 1] - a[i])));
  }
  cout << f[1] + a[1];
  return 0;
}
