#include <bits/stdc++.h>
#define oo 100005
using namespace std;
int n, a[oo], e, t, q[oo];
long long dp[oo], sum[oo], f[oo];
int main ()
{
    scanf("%d%d%d", &n, &e, &t);
    for(int i = 1; i <= n; ++ i)
    scanf("%d", &a[i]);
    memset(dp, 63, sizeof dp);
    sum[0] = -2 * a[1]; dp[0] = 0;
    for(int i = 1, lim = 0, l = 1, r = 1; i <= n; ++ i)
    {
        while(2 * (a[i] - a[lim + 1]) > t) ++ lim;
        while(q[l] < lim && l <= r) ++ l;
        if(l <= r) dp[i] = min(dp[i], f[l] + t + a[i]);
        if(lim > 0) dp[i] = min(dp[i], sum[lim - 1] + 3ll * a[i]);
        sum[i] = min(sum[i - 1], dp[i] - a[i] - 2ll * a[i + 1]);
        while(f[r] >= dp[i] - a[i] && l <= r) -- r;
        q[++ r] = i, f[r] = dp[i] - a[i];
    }
    printf("%lld", dp[n] + e - a[n]); return 0;
}