#include <bits/stdc++.h>
using namespace std;
struct StarrySkyTree {
  vector<long long> seg, lazy;
  int size;
  StarrySkyTree() {}
  StarrySkyTree(int n) { init(n); }
  void init(int n) {
    size = 1;
    while (size < n) size *= 2;
    seg.resize(size * 2);
    lazy.resize(size * 2);
    for (long long i = 0; i < size * 2; i++) seg[i] = 1e16;
  }
  void update(int k, long long v) {
    k += size - 1;
    seg[k] = v;
    while (k > 0) {
      k = (k - 1) / 2;
      seg[k] = min(seg[k * 2 + 1], seg[k * 2 + 2]);
    }
  }
  void push(int k, int l, int r) {
    seg[k] += lazy[k];
    if (r - l > 1) {
      lazy[k * 2 + 1] += lazy[k];
      lazy[k * 2 + 2] += lazy[k];
    }
    lazy[k] = 0;
  }
  void add(int a, int b, long long v, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      lazy[k] += v;
      push(k, l, r);
    } else {
      add(a, b, v, k * 2 + 1, l, (l + r) / 2);
      add(a, b, v, k * 2 + 2, (l + r) / 2, r);
      seg[k] = min(seg[k * 2 + 1], seg[k * 2 + 2]);
    }
  }
  void add(int a, int b, long long v) { add(a, b, v, 0, 0, size); }
  long long query(int a, int b, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return 1e16 * 100;
    if (a <= l && r <= b) return seg[k];
    long long vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    long long vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
  long long query(int a, int b) { return query(a, b, 0, 0, size); }
};
long long n, T, E;
long long x[101010];
set<pair<long long, long long> > st;
StarrySkyTree dp, dp1, dp2;
int main() {
  cin >> n >> E >> T;
  for (long long i = (long long)(0); i < (long long)(n); i++) cin >> x[i];
  for (long long i = (long long)(0); i < (long long)(n); i++)
    st.insert(pair<long long, long long>(-2 * x[i], i));
  x[n] = E;
  dp.init(n + 1);
  dp1.init(n + 1);
  dp2.init(n + 1);
  for (long long i = (long long)(0); i < (long long)(n + 1); i++) {
    dp.update(i, 0);
    dp1.update(i, 0);
    dp2.update(i, 0);
  }
  dp.update(0, x[0]);
  dp1.update(0, x[0] - x[0]);
  dp2.update(0, x[0] - 2 * x[0]);
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    long long k;
    if (st.lower_bound(pair<long long, long long>(-2 * x[i] + T, -1e16)) ==
        st.end())
      k = -1;
    else
      k = st.lower_bound(pair<long long, long long>(-2 * x[i] + T, -1e16))
              ->second;
    k++;
    long long crt = 1e16;
    crt = (crt < dp2.query(0, k) + 2 * x[i] ? crt : dp2.query(0, k) + 2 * x[i]);
    crt =
        (crt < dp1.query(k, i + 1) + x[i] + T ? crt
                                              : dp1.query(k, i + 1) + x[i] + T);
    crt += x[i + 1] - x[i];
    dp.add(i + 1, i + 2, crt);
    dp1.add(i + 1, i + 2, crt - x[i + 1]);
    dp2.add(i + 1, i + 2, crt - 2 * x[i + 1]);
    dp.add(0, i + 1, x[i + 1] - x[i]);
    dp1.add(0, i + 1, x[i + 1] - x[i]);
    dp2.add(0, i + 1, x[i + 1] - x[i]);
  }
  cout << dp.query(n, n + 1) << endl;
  return 0;
}
