#include <bits/stdc++.h>
using namespace std;
const long long N = (long long)1e5 + 5, mod = (long long)0;
long long a[N], dp[N];
set<pair<long long, long long>> x, y;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, e, t;
  cin >> n >> e >> t;
  a[n] = e;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  dp[0] = a[0];
  long long p = 0;
  y.insert(make_pair(dp[0] - 2 * a[0] + t, 0));
  for (long long i = 0; i < n; ++i) {
    while (p < i + 1 && (a[i] - a[p]) * 2 > t) {
      y.erase(make_pair(dp[p] - 2 * a[p] + t, p));
      x.insert(make_pair(dp[p] - 3 * a[p], p));
      p++;
    }
    dp[i + 1] = 1e18;
    if ((long long)x.size()) {
      auto d = *(x.begin());
      dp[i + 1] = min(dp[i + 1], a[i + 1] - a[i] + 3 * a[i] + d.first);
    }
    if ((long long)y.size()) {
      auto d = *(y.begin());
      dp[i + 1] = min(dp[i + 1], a[i + 1] - a[i] + 2 * a[i] + d.first);
    }
    y.insert(make_pair(dp[i + 1] - 2 * a[i + 1] + t, i + 1));
  }
  cout << dp[n] << endl;
}
