#include <bits/stdc++.h>
using namespace std;
const long long max_n = 1e6 + 20, inf = 1e12;
long long a[max_n], DP[max_n];
pair<long long, long long> seg[max_n * 4];
long long n, e, t, INF = 1e12, L;
pair<long long, long long> Merge(pair<long long, long long> x,
                                 pair<long long, long long> y) {
  if (x.first < y.first) return x;
  return y;
}
void update(long long x, long long val, long long b = 0, long long e = n,
            long long id = 1) {
  if (e - b == 1) {
    seg[id].first = val;
    seg[id].second = x;
    return;
  }
  long long mid = e + b >> 1;
  if (x >= mid)
    update(x, val, mid, e, id << 1 | 1);
  else
    update(x, val, b, mid, id << 1);
  seg[id] = Merge(seg[id << 1 | 1], seg[id << 1]);
}
pair<long long, long long> get(long long l, long long r, long long b = 0,
                               long long e = n, long long id = 1) {
  if (e <= l || r <= b) return {INF, 0};
  if (l <= b && e <= r) {
    return seg[id];
  }
  long long mid = b + e >> 1;
  return Merge(get(l, r, b, mid, id << 1), get(l, r, mid, e, id << 1 | 1));
}
void out() {
  for (long long i = 1; i < n * 4; i++)
    cout << seg[i].second << ">>>>>" << seg[i].first << "   ";
  cout << endl;
}
void solve() {
  for (long long i = 1; i < n; i++) {
    long long tmp = (lower_bound(a, a + n, a[i] - L) - a);
    pair<long long, long long> x = get(tmp, i), y = get(0, tmp);
    DP[i] = min(x.first + t, y.first + 2 * (a[i] - a[y.second])) + a[i];
    DP[i] = min(DP[i], DP[i - 1] + a[i] - a[i - 1] + t);
    update(i, DP[i - 1] - a[i - 1]);
  }
}
int32_t main() {
  cin >> n >> e >> t;
  L = (t + 1) / 2;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n * 4; i++) seg[i].first = inf;
  DP[0] = a[0] + t;
  update(0, 0);
  solve();
  cout << DP[n - 1] + (e - a[n - 1]);
  return 0;
}
