#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int Nmax = 1e5 + 5;

int E, n, T, i, j, x[Nmax];
ll dp[Nmax], A[Nmax], B[Nmax];
deque<int> dq;

int main()
{
  //  freopen("input", "r", stdin);
    cin.sync_with_stdio(false);

    cin >> n >> E >> T;
    for(i=1; i<=n; ++i) cin >> x[i];

    for(i=1; i<=n; ++i)
    {
        A[i] = min(A[i-1], dp[i-1] - x[i-1] - 2 * x[i]);
        B[i] = dp[i-1] - x[i-1];

        while(j < i && 2 * (x[i] - x[j+1]) > T) ++j;
        while(dq.size() && B[dq.back()] >= B[i]) dq.pop_back();
        dq.push_back(i);
        while(dq.size() && dq.front() <= j) dq.pop_front();

        dp[i] = x[i] + min(dq.size() ? T + B[dq.front()] : (1LL<<60), j ? A[j] + 2 * x[i] : (1LL<<60));
    }

    cout << dp[n] + E - x[n] << '\n';

    return 0;
}
