/+ dub.sdl:
    name "A"
    dependency "dcomp" version=">=0.0.2"
+/

import std.algorithm, std.range, std.stdio, std.math, std.conv, core.bitop;

import dcomp.scanner;
import dcomp.algorithm;

struct Node {
    alias NP = Node*;
    long mi;
    NP l, r;
    int sz;
    this(int sz) {
        this.sz = sz;
        if (sz == 1) return;
        l = new Node(sz/2);
        r = new Node(sz-sz/2);
    }
    void set(int k, long x) {
        if (sz == 1) {
            mi = x;
            return;
        }
        if (k < sz/2) {
            l.set(k, x);
        } else {
            r.set(k-sz/2, x);
        }
        mi = min(l.mi, r.mi);
    }
    long get(int a, int b) {
        if (b <= 0 || sz <= a) return 10L^^12;
        if (a <= 0 && sz <= b) return mi;
        return min(l.get(a, b), r.get(a-sz/2, b-sz/2));
    }
    string toString() {
        if (sz == 1) {
            return mi.to!string ~ ", ";
        }
        return l.toString ~ r.toString;
    }
}

int main() {
    import std.conv;
    auto sc = new Scanner();
    int n; long e, T;
    long[] x;
    sc.read(n, e, T, x);
    x ~= e;
    long[] next = iota(n).map!(i => x[i+1]-x[i]).array;
//    writeln(next);
    long[] dp = new long[](n+1);
    Node* tr1 = new Node(n); //dp[i+1] + 3*dist[j] + next[j]
    Node* tr2 = new Node(n); //dp[i+1] + T + dist[j] + next[j]
    dp[n] = 0;
    foreach_reverse (i; 0..n) {
        tr1.set(i, dp[i+1] + 3*x[i] + next[i]);
        tr2.set(i, dp[i+1] + T + x[i] + next[i]);
//        writeln(tr1.toString);
//        writeln(tr2.toString);
        int div = binSearch!(j => 2*(x[j]-x[i]) >= T)(i, n);
        //[div, n-1) tr1
        //[i, div) tr2
        long ans = 10L^^12;
        ans = min(ans, tr1.get(div, n) - 3*x[i]);
//        writeln(i, " a ", div, " ", tr1.get(div, n));
        ans = min(ans, tr2.get(i, div) - x[i]);
        dp[i] = ans;
    }
//    writeln(dp);
    writeln(dp[0] + x[0]);
	return 0;
}
