#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, e, t;
  cin >> n >> e >> t;
  long long arr[n + 2];
  for (int i = 1; i <= n; i++) cin >> arr[i];
  arr[0] = 0;
  long long far[n + 2];
  long long dp[n + 2];
  multiset<long long> close;
  dp[0] = 0;
  far[0] = -2 * arr[1];
  close.insert(0);
  int c = 0;
  for (int i = 1; i <= n; i++) {
    while (2 * (arr[i] - arr[c + 1]) > t) {
      close.erase(dp[c] - arr[c]);
      c++;
    }
    dp[i] = 10234567890123242;
    if (c != 0) {
      dp[i] = min(dp[i], far[c - 1] + 3 * arr[i]);
    }
    if (!close.empty()) {
      long long v = *(close.begin());
      dp[i] = min(dp[i], v + t + arr[i]);
    }
    far[i] = dp[i] - 2 * arr[i + 1] - arr[i];
    far[i] = max(far[i], far[i - 1]);
    close.insert(dp[i] - arr[i]);
  }
  cout << dp[n] + (e - arr[n]);
}
