#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * neg;
}
inline void print(long long x) {
  if (x < 0) {
    putchar('-');
    print(abs(x));
    return;
  }
  if (x <= 9)
    putchar(x + '0');
  else {
    print(x / 10);
    putchar(x % 10 + '0');
  }
}
long long n = read(), E = read(), T = read(), a[100005];
long long dp[100005];
signed main() {
  for (long long i = 1; i <= n; i++) a[i] = read();
  memset(dp, 63, sizeof(dp));
  deque<long long> q;
  q.push_back(0);
  dp[0] = 0;
  for (long long i = 1; i <= n; i++) {
    long long mn = 0x3f3f3f3f3f3f3f3fll;
    while (!q.empty() && 2 * (a[i] - a[q.front() + 1]) > T) {
      long long j = q.front();
      mn = min(mn, dp[j] + a[i] - a[j] + 2 * (a[i] - a[j + 1]));
      q.pop_front();
    }
    dp[i] = min(dp[i], dp[q.front()] + a[i] - a[q.front()] + T);
    dp[i] = min(dp[i], mn);
    q.push_back(i);
  }
  cout << dp[n] + abs(a[n] - E) << endl;
  return 0;
}
