#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int n;
long long t, e, x[N], f[N];
long long calc(int l, int r) {
  return x[r] - x[l] + max(x[r] - x[l + 1], t - (x[r] - x[l + 1])) + x[r] -
         x[l + 1];
}
int main() {
  cin >> n >> e >> t;
  for (int i = 1; i <= n; i++) x[i] = gi();
  memset(f, 0x3f, sizeof(f));
  f[0] = 0;
  for (int i = 1; i <= n; i++) {
    f[i] = calc(0, i);
    for (int j = 1; j < i; j++) f[i] = min(f[i], f[j] + calc(j, i));
  }
  printf("%lld\n", f[n] + abs(x[n] - e));
  return 0;
}
