#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template <class T = int>
using V = vector<T>;
template <class T = int>
using VV = V<V<T> >;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  assert(n <= 2000);
  lint E, T;
  cin >> E >> T;
  V<lint> x(n);
  for (auto&& e : x) cin >> e;
  x.push_back(E);
  V<lint> dp(n + 1, 9e18);
  dp[n] = 0;
  for (int i = n - 1; i >= 0; --i) {
    int k = lower_bound(begin(x), end(x), x[i] + (T + 1) / 2) - begin(x) + 1;
    for (int j = i + 1; j <= n; ++j) {
      if (j < k) {
        dp[i] = min(dp[i], T - x[i] + x[j] + dp[j]);
      } else {
        dp[i] = min(dp[i], -3 * x[i] + 2 * x[j - 1] + x[j] + dp[j]);
      }
    }
  }
  cout << x[0] + dp[0] << '\n';
}
