#include <bits/stdc++.h>
using namespace std;
int N, E, T;
int X[202020];
signed long long memo[2200][2200];
signed long long dpdp(int yet, int cur) {
  if (memo[yet][cur] >= 0) return memo[yet][cur];
  signed long long ret = 0;
  if (cur == N - 1) {
    ret = max(T - (X[cur] - X[yet]), (X[cur] - X[yet])) + (X[cur] - X[yet]);
  } else {
    ret = max(T - (X[cur] - X[yet]), (X[cur] - X[yet])) + X[cur + 1] - X[yet] +
          dpdp(cur + 1, cur + 1);
    ret = min(ret, X[cur + 1] - X[cur] + dpdp(yet, cur + 1));
  }
  return memo[yet][cur] = ret;
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> E >> T;
  for (i = 0; i < (N); i++) cin >> X[i];
  signed long long ret = X[0] + (E - X[N - 1]);
  x = X[0];
  for (i = 0; i < (N); i++) X[i] -= x;
  if (N > 2000) return;
  memset(memo, 0xff, sizeof(memo));
  cout << ret + dpdp(0, 0) << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}
