#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vb = vector<bool>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vvvpii = vector<vvpii>;
template <typename T>
T read() {
  T t;
  cin >> t;
  return t;
}
template <class T>
bool amin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
void Main() {
  int n = read<int>();
  int e = read<int>();
  int t = read<int>();
  vector<int> X(n);
  for (int i = int(0); i < int(n); ++i) X[i] = read<int>();
  if (n > 2000) return;
  const ll inf = 1e18 + 7;
  vl dp(n + 2, inf);
  dp[0] = 0;
  for (int i = int(0); i < int(n); ++i)
    if (dp[i] < inf) {
      int pos = (i == 0 ? 0 : X[i - 1]);
      for (int j = int(i); j < int(n + 1); ++j) {
        int a = X[j] - pos;
        int b = X[j] - X[i];
        int c;
        if (b * 2 >= t)
          c = 0;
        else
          c = t - b * 2;
        amin(dp[j + 1], dp[i] + a + 2LL * b + c);
      }
    }
  ll ans = dp[n] + abs(e - X[n - 1]);
  cout << ans << endl;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  Main();
  return 0;
}
