#include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;

class LazySegmentTree {
    public:
    
    LazySegmentTree(int n) {
        size = 1;
        while (size < n) size <<= 1;
        
        data = (long long *)malloc(sizeof(long long) * size * 2);
        lazy = (long long *)malloc(sizeof(long long) * size * 2);
        
        for (int i = 0; i < size * 2; i++) data[i] = lazy[i] = 0;
    }
    
    ~LazySegmentTree() {
        free(data);
        free(lazy);
    }
    
    //[x,y)
    void update(int x, int y, long long v) {
        int len = 0;
        
        get(x, y, len);
        
        for (int i = len - 1; i >= 0; i--) propagate(index[i]);
        
        while (0 < x && x + (x & -x) <= y) {
            lazy[(size + x) / (x & -x)] += v;
            propagate((size + x) / (x & -x));
            x += x & -x;
        }
        
        while (x < y) {
            lazy[(size + y) / (y & -y) - 1] += v;
            propagate((size + y) / (y & -y) - 1);
            y -= y & -y;
        }
        
        for (int i = 0; i < len; i++) merge(index[i]);
    }
    
    //[x,y)
    long long query(int x, int y) {
        int len = 0;
        long long ans = 1e18;
        
        get(x, y, len);
        
        for (int i = len - 1; i >= 0; i--) propagate(index[i]);
        
        while (0 < x && x + (x & -x) <= y) {
            propagate((size + x) / (x & -x));
            ans = min(ans, data[(size + x) / (x & -x)]);
            x += x & -x;
        }
        
        while (x < y) {
            propagate((size + y) / (y & -y) - 1);
            ans = min(ans, data[(size + y) / (y & -y) - 1]);
            y -= y & -y;
        }
        
        for (int i = 0; i < len; i++) merge(index[i]);
        
        return ans;
    }
    
    private:
    
    int size;
    long long *data, *lazy;
    int index[64];
    
    void propagate(int x) {
        if (x < size) {
            lazy[x * 2] += lazy[x];
            lazy[x * 2 + 1] += lazy[x];
        }
        
        data[x] += lazy[x];
        lazy[x] = 0;
    }
    
    void merge(int x) {
        data[x] = min(data[x * 2] + lazy[x * 2], data[x * 2 + 1] + lazy[x * 2 + 1]);
    }
    
    void get(int x, int y, int &len) {
        for (int l = x ? ((size + x) / (x & -x)) >> 1 : 0, r = ((size + y) / (y & -y) - 1) >> 1; ; r >>= 1) {
            if (l == r) {
                for (; l > 0; l >>= 1) index[len++] = l;
                return;
            }
            
            if (l > r) swap(l, r);
            index[len++] = r;
        }
    }
};


int x[100001];

int main() {
    int n, e, t, last = 0, i, j;
    
    scanf("%d %d %d", &n, &e, &t);
    
    for (i = 0; i < n; i++) scanf("%d", &x[i]);
    
    x[n] = e;
    
    LazySegmentTree s(n + 1);
    
    s.update(0, 1, x[0]);
    
    for (i = 1; i <= n; i++) {
        long long ans = 1e18;
        
        if (i > 1) s.update(0, i - 1, x[i - 1] - x[i - 2]);
        
        if (last > 0) s.update(0, last, (x[i - 1] - x[i - 2]) * 2);
        
        for (; last < i - 1; last++) {
            if ((x[i - 1] - x[last]) * 2 <= t) break;
            
            s.update(last, last + 1, (x[i - 1] - x[last]) * 2);
        }
        
        if (last > 0) ans = min(ans, s.query(0, last) + x[i] - x[i - 1]);
        ans = min(ans, s.query(last, i) + t + x[i] - x[i - 1]);
        
        s.update(i, i + 1, ans);
    }
    
    printf("%lld\n", s.query(n, n + 1));
    
    return 0;
}


Measured memory_bytes: 4864