Problem:
Score : 1100 points

Problem Statement

There is a set consisting of N distinct integers. The i-th smallest element in this set is S_i. We want to divide this set into two sets, X and Y, such that:

The absolute difference of any two distinct elements in X is A or greater.

The absolute difference of any two distinct elements in Y is B or greater.

How many ways are there to perform such division, modulo 10^9 + 7? Note that one of X and Y may be empty.

Constraints

All input values are integers.

1 ≦ N ≦ 10^5

1 ≦ A , B ≦ 10^{18}

0 ≦ S_i ≦ 10^{18}(1 ≦ i ≦ N)

S_i < S_{i+1}(1 ≦ i ≦ N - 1)

Input

The input is given from Standard Input in the following format:

N A B
S_1
:
S_N

Output

Print the number of the different divisions under the conditions, modulo 10^9 + 7.

Sample Input 1

5 3 7
1
3
6
9
12

Sample Output 1

5

There are five ways to perform division:

X={1,6,9,12}, Y={3}

X={1,6,9}, Y={3,12}

X={3,6,9,12}, Y={1}

X={3,6,9}, Y={1,12}

X={3,6,12}, Y={1,9}

Sample Input 2

7 5 3
0
2
4
7
8
11
15

Sample Output 2

4

Sample Input 3

8 2 9
3
4
5
13
15
22
26
32

Sample Output 3

13

Sample Input 4

3 3 4
5
6
7

Sample Output 4

0

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

/// In The Name Of God

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};

using namespace std;

int n;
int nxt[N][2];
ll A, B;
ll a[N];

void add(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}
int sum(int x, int y) {
	add(x, y);
	return x;
}

struct tree {
	int f[N];
	void upd(int p, int x) {
		for (; p < N; p |= p + 1) add(f[p], x);
	}
	int get(int p) {
		int res = 0;
		for (; p >= 0; p = (p & (p + 1)) - 1) {
			add(res, f[p]);
		}
		return res;
	}
	int get(int l, int r) {
		return sum(get(r), get(l - 1));
	}
};

bool good(int l, int r, bool type) {
	rep(i, l + 1, r) {
		if (!type && a[i] - a[i - 1] < A) return 0;
		if (type && a[i] - a[i - 1] < B) return 0;
	}
	return 1;
}
int dp[N][2], to[N][2];
int calc(int v = 1, bool type = 0) {
	if (v > n) return 1;
	if (~dp[v][type]) return dp[v][type];
	int res = 0;
	rep(i, v, to[v][type]) {
		if (to[i + 1][type ^ 1] >= nxt[i][type]) add(res, calc(nxt[i][type], type ^ 1));
		/// [i + 1, nxt[i][type] - 1)
	}
	return dp[v][type] = res;
}
int main() {
	#ifdef IOI2018
		freopen ("in.txt", "r", stdin);
	#endif
	Kazakhstan
	cin >> n >> A >> B;
	rep(i, 1, n) {
		cin >> a[i];
	}
	a[n + 1] = a[n] + linf;	
	{
		int p = n;
		to[n + 1][1] = to[n + 1][0] = n + 1;
		per(i, n, 1) {
			while (a[p] - a[i] >= A) p--;
			nxt[i][0] = p + 1;
			if (a[i + 1] - a[i] >= A && i < n) to[i][0] = to[i + 1][0];
			else to[i][0] = i;
		}
		p = n;
		per(i, n, 1) {
			while (a[p] - a[i] >= B) p--;
			nxt[i][1] = p + 1;
			if (a[i + 1] - a[i] >= B && i < n) to[i][1] = to[i + 1][1];
			else to[i][1] = i;
		}
	}
	rep(i, 1, n) {
		rep(type, 0, 1) {
			nxt[i][type] = max(nxt[i][type] - 1, i + 1);
		}
	}

	dp[n + 1][0] = dp[n + 1][1] = 1;
	per(i, n, 1) {
		rep(type, 0, 1) {
			int l = i, r = to[i][type], res = n + 2;
			/*
			while (l <= r) {
				int mid = (l + r) >> 1;
				if (to[mid + 1][type ^ 1] >= nxt[i][type]) res = mid, r = mid - 1;
				else l = mid + 1;
			}*/
			rep(j, i, to[i][type]) {
				if (to[i + 1][type ^ 1] >= nxt[i][type]) add(dp[i][type], dp[nxt[i][type]][type ^ 1]);
			}
		}
	}

	/*
	memset(dp, -1, sizeof(dp));
	cout << sum(calc(1, 0), calc(1, 1));*/
	
	cout << sum(dp[1][0], dp[1][1]);
	ioi
}