#include <bits/stdc++.h>
using namespace std;

template<class Monoid, class OperatorMonoid, class FunctionM, class FunctionMO, class FunctionO>
struct LazySegmentTree {
    int N; vector<Monoid> segment; vector<OperatorMonoid> lazy;
    const FunctionM FuncM; const FunctionMO FuncMO; const FunctionO FuncO;
    const Monoid idM; const OperatorMonoid idOM;

    LazySegmentTree(int n, const FunctionM FuncM, const FunctionMO FuncMO, const FunctionO FuncO,
        const Monoid idM, const OperatorMonoid idOM)
    : FuncM(FuncM), FuncMO(FuncMO), FuncO(FuncO), idM(idM), idOM(idOM) {
        N = 1;
        while (N < n) N <<= 1;
        segment.assign(2 * N, idM); lazy.assign(2 * N, idOM);
    }

    LazySegmentTree(int n, const FunctionM FuncM, const FunctionMO FuncMO, const FunctionO FuncO,
        const Monoid idM, const OperatorMonoid idOM, const Monoid initVal)
    : FuncM(FuncM), FuncMO(FuncMO), FuncO(FuncO), idM(idM), idOM(idOM) {
        N = 1;
        while (N < n) N <<= 1;
        segment.assign(2 * N, initVal); lazy.assign(2 * N, idOM);
    }

    void set(int num, Monoid x) {
        segment[N + num] = x;
    }
    void build() {
        for (int k = N - 1; k > 0; k--) {
            segment[k] = FuncM(segment[2*k], segment[2*k+1]);
        }
    }

    inline void propagate(int k, int len){
        if (lazy[k] != idOM) {
            if (k < N) {
                lazy[2*k] = FuncO(lazy[2*k], lazy[k]);
                lazy[2*k+1] = FuncO(lazy[2*k+1], lazy[k]);
            }
            segment[k] = FuncMO(segment[k], lazy[k], len);
            lazy[k] = idOM;
        }
    }

    // update:[a, b)
    Monoid update(int a, int b, const OperatorMonoid x) {
        return update(a, b, x, 1, 0, N);
    }
    Monoid update(int a, int b, const OperatorMonoid x, int k, int l, int r){
        propagate(k, r-l);
        if (b <= l || r <= a) {
            return segment[k];
        } else if (a <= l && r <= b) {
            lazy[k] = FuncO(lazy[k], x);
            propagate(k, r-l);
            return segment[k];
        } else {
            int m = (l + r) / 2;
            return segment[k] = FuncM(update(a, b, x, 2*k, l, m), update(a, b, x, 2*k+1, m, r));
        }
    }

    // query:[a, b)
    Monoid query(int a, int b) {
        return query(a, b, 1, 0, N);
    }
    Monoid query(int a, int b, int k, int l, int r) {
        propagate(k, r-l);
        if (b <= l || r <= a) {
            return idM;
        } else if (a <= l && r <= b) {
            return segment[k];
        } else {
            int m = (l + r) / 2;
            return FuncM(query(a, b, 2*k, l, m), query(a, b, 2*k+1, m, r));
        }
    }

    // 0-indexed numbering;
    inline Monoid operator[](const int &k) {
        return query(k, k + 1);
    }
};

auto F = [&](long long a, long long b) {return min(a, b);};
auto G = [&](long long a, long long b, int len) {return a + b;};
auto H = [&](long long a, long long b) {return a + b;};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, e, t; cin >> n >> e >> t;
    vector<int> x(n+2, 0);
    for (int i = 0; i < n; i++) {
        cin >> x[i+1]; x[i+1] *= 2;
    }
    x[n+1] = 2 * e;
    LazySegmentTree<long long, long long, decltype(F), decltype(G), decltype(H)> dp(n + 1, F, G, H, 1e16, 0);
    LazySegmentTree<long long, long long, decltype(F), decltype(G), decltype(H)> lst(n + 1, F, G, H, 1e16, 0);
    for (int i = 0; i <= n; i++) lst.set(i, 0), dp.set(i, 0);
    dp.set(0, -x[1]);
    lst.build(); dp.build();
    int lf = 0;
    for (int i = 0; i < n; i++) {
        int d = (x[i+1] - x[i]) / 2;
        lst.update(0, i+1, d);
        dp.update(0, i+1, d);
        int c = lower_bound(x.begin(), x.end(), x[i+1]-t) - x.begin();
        long long p = dp.query(0, c-1);
        long long q = lst.query(c-1, i+1);
        auto w = min(p+x[i+1], q+t);
        dp.update(i+1, i+2, w-x[i+2]);
        lst.update(i+1, i+2, w);
    }
    cout << lst[n] + (e - x[n] / 2) << "\n";
    return 0;
}

Measured memory_bytes: 8832