#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1e5 + 10, INF = 2e18;
int x[MAXN], dp[MAXN];
int n, e, t;
int32_t main () {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n >> e >> t;
    for (int i =0; i < n; ++i) {
        cin >> x[i];
        dp[i] = INF;
    }
    x[n] = e;
    int mn = INF;
    int point = n;
    for (int i = n - 1; i >= 0; --i) {
        while (x[point - 1] - x[i] > t / 2) {
            mn = min(mn,dp[point] + x[point] + 2 * x[point - 1]);
            --point;
        }
        dp[i] = min(mn - 3 * x[i], dp[point] + x[point] - x[i] + t);
    }
    cout << dp[0] + x[0];
    return 0;
}