#include <bits/stdc++.h>
using namespace std;
const int maxN = 10000 * 100 + 10;
long long a[maxN];
const long long inf = 2e18;
long long dp[maxN];
set<pair<long long, int>> curr1, curr2;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  a[0] = 0;
  int n, e, T;
  cin >> n >> e >> T;
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
    a[i + 1] = e - a[i + 1];
  }
  reverse(a + 1, a + n + 1);
  curr1.insert({inf, -1});
  curr2.insert({inf, -1});
  fill(dp, dp + n + 1, inf);
  dp[0] = 0;
  int last = 0;
  curr1.insert({0ll - a[1], 0});
  for (int i = 1; i <= n; i++) {
    while (last < i && 2ll * (a[i] - a[last + 1]) >= T) {
      curr1.erase({0ll + dp[last] - a[last + 1], last});
      curr2.insert({0ll + dp[last] - 2ll * a[last + 1], last});
      last++;
    }
    dp[i] = min(0ll + curr1.begin()->first + 1ll * a[i] + T,
                0ll + curr2.begin()->first + 2ll * a[i]);
    curr1.insert({dp[i] - a[i + 1], i});
  }
  cout << dp[n] + e << endl;
}
