#include <bits/stdc++.h>
using namespace std;
long long dp[100010], pos[100010], m, t, pre;
priority_queue<pair<long long, int> > q;
int n;
int main() {
  freopen("computer.in", "r", stdin);
  freopen("computer.out", "w", stdout);
  scanf("%d%lld%lld", &n, &m, &t);
  for (int i = 1; i <= n; i++) scanf("%lld", &pos[i]);
  q.push(make_pair(0, 0));
  int las = 0;
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1] + t + pos[i] - pos[i - 1];
    while (1) {
      pair<long long, int> x = q.top();
      if (2ll * (pos[i] - pos[x.second + 1]) <= t) {
        dp[i] = min(dp[i], -x.first + pos[i] + t);
        break;
      }
      q.pop();
    }
    while (2ll * (pos[i] - pos[las + 2]) > t) {
      las++;
      pre = min(pre, dp[las] - pos[las] - 2ll * pos[las + 1]);
    }
    if ((pos[i] - pos[las + 1]) * 2ll > t)
      dp[i] = min(dp[i], pre + 3ll * pos[i]);
    q.push(make_pair(-dp[i] + pos[i], i));
  }
  printf("%lld", dp[n] + m - pos[n]);
}
