#include <bits/stdc++.h>
using namespace std;
const long long Inf = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, e, t;
  cin >> n >> e >> t;
  vector<long long> x(n + 1);
  for (int i = 0; i < n; ++i) cin >> x[i + 1];
  x[0] = 0;
  vector<long long> dp(n + 1, Inf);
  dp[0] = 0;
  long long bestF = Inf;
  auto relaxF = [&](int i) {
    bestF = min(bestF, dp[i] - x[i] - (long long)t * i);
  };
  auto get0 = [&](int i) { return dp[i] - x[i] - 2 * x[i + 1]; };
  auto gett = [&](int i) { return dp[i] - x[i] - 2 * x[i + 1] + 2 * x[i + 1]; };
  relaxF(0);
  multiset<long long> h0, ht;
  ht.insert(gett(0));
  int uk = 0;
  for (int i = 1; i <= n; ++i) {
    while (uk < i && t - 2 * x[i] + 2 * x[uk + 1] < 0) {
      ht.erase(gett(uk));
      h0.insert(get0(uk));
      ++uk;
    }
    dp[i] = bestF + x[i] + (long long)t * i;
    if (!h0.empty()) dp[i] = min(dp[i], *h0.begin() + 3 * x[i]);
    if (!ht.empty()) dp[i] = min(dp[i], *ht.begin() + 3 * x[i] + t - 2 * x[i]);
    relaxF(i);
    ht.insert(gett(i));
  }
  cout << dp[n] + e - x[n] << '\n';
}
