#include <bits/stdc++.h>
using namespace std;
long long INF = 1e18;
deque<pair<long long, long long> > dq;
long long max_constant;
long long N, E, T;
long long off;
long long D[100100];
long long dp[100100];
queue<pair<long long, long long> > Q;
multiset<long long> S2;
int main() {
  cin >> N >> E >> T;
  for (int i = 1; i <= N; ++i) cin >> D[i];
  dp[0] = 0;
  max_constant = -INF;
  Q.push(make_pair(T + 2 * D[1], 2 * D[1]));
  S2.insert(T + 4 * D[1]);
  for (int i = 1; i <= N; ++i) {
    while ((long long)Q.size() && Q.front().first <= 2 * D[i]) {
      pair<long long, long long> cur = Q.front();
      Q.pop();
      max_constant = max(max_constant, cur.second);
      S2.erase(S2.find(cur.first + cur.second));
    }
    dp[i] = INF;
    dp[i] = min(dp[i], 3 * D[i] - max_constant);
    dp[i] = min(dp[i], T + D[i] - D[i - 1] + dp[i - 1]);
    if ((long long)S2.size()) dp[i] = min(dp[i], *S2.begin() + D[i]);
    Q.push(make_pair(T + 2 * D[i + 1], -2 * D[i + 1] - D[i] + dp[i]));
    S2.insert(T - D[i] + dp[i]);
  }
  cout << dp[N] + E - D[N];
}
