#include <bits/stdc++.h>
using namespace std;
const int MN = 1e5 + 5;
int N, M, W, E, i, j;
long long dp[MN], arr[MN], ans;
int main() {
  for (scanf("%d%d%d", &N, &E, &W), i = 1; i <= N; i++) {
    scanf("%lld", &arr[i]);
  }
  for (i = 1; i <= N; i++) {
    if (arr[i] <= E) M++;
  }
  for (i = j = M; i >= 1; i--) {
    while (2 * (arr[j] - arr[i]) > W) j--;
    dp[i] = dp[j + 1] + arr[j] - arr[i] + W;
    if (j + 1 <= M) dp[i] += arr[j + 1] - arr[j];
    if (j + 2 <= M)
      dp[i] = min(
          dp[i], dp[j + 2] + 2LL * (arr[j + 1] - arr[i]) + arr[j + 2] - arr[i]);
    else if (j + 1 <= M)
      dp[i] = min(dp[i], dp[j + 2] + 3LL * (arr[j + 1] - arr[i]));
  }
  dp[1] += arr[1];
  if (M < N)
    dp[1] += 2 * arr[N] - arr[M] - E + W;
  else
    dp[1] += E - arr[N];
  printf("%lld\n", dp[1]);
  return 0;
}
