#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string &s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.push_back(x);
  return v;
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << "[DEBUG] " << it->substr((*it)[0] == ' ', it->length()) << " = " << a
       << '\n';
  err(++it, args...);
}
const int MOD = 1000000007;
template <class T, class U>
inline T tmin(T a, U b) {
  return (a < b) ? a : b;
}
template <class T, class U>
inline T tmax(T a, U b) {
  return (a > b) ? a : b;
}
template <class T, class U>
inline void amax(T &a, U b) {
  if (b > a) a = b;
}
template <class T, class U>
inline void amin(T &a, U b) {
  if (b < a) a = b;
}
template <class T>
inline T tabs(T a) {
  return (a > 0) ? a : -a;
}
template <class T>
T gcd(T a, T b) {
  while (b != 0) {
    T c = a;
    a = b;
    b = c % b;
  }
  return a;
}
const int M = 100005, N = 2005;
int x[M];
long long dp[N][N];
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  int n, e, t;
  cin >> n >> e >> t;
  for (int i = (1); i < (n + 1); ++i) cin >> x[i];
  if (n < N) {
    int ans = 0;
    dp[0][0] = 0;
    for (int j = (1); j < (n + 1); ++j) {
      dp[1][j] = x[j] * 2 - x[1] + max(0, t - 2 * (x[j] - x[1]));
      for (int i = (2); i < (j + 1); ++i) {
        long long tmp = dp[i - 1][i - 1] + 2 * x[j] - x[i] - x[i - 1] +
                        max(0, t - 2 * (x[j] - x[i]));
        dp[i][j] = min(tmp, dp[i - 1][j] + x[i] - x[i - 1]);
      }
    }
    printf("%lld\n", dp[n][n] + e - x[n]);
  } else
    puts("0");
  return 0;
}
