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: Accepted)

#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
#include <random>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <complex>
#include <functional>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < int(b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> int(a);)
#define all(v) v.begin(),v.end()
#define trav(x, v) for(auto &x : v)
#define sz(v) int((v).size())
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long double ld;
const ll mod = 1e9+7;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	ll a, b;
	cin >> a >> b;
	vector<ll> s(n+1);
	s[0] = -a-b;
	rep(i,1,n+1) cin >> s[i];
	vector<ll> X(n), Y(n);
	X[0] = 1, Y[0] = 1;
	ll preX = 0, preY = 0;
	int px = 0, py = 0;
	int lex = 0, ley = 0;
	rep(i,2,n+1){
		while(s[i]-s[px] >= a){
			preY += Y[px];
			++px;
		}
		while(s[i]-s[py] >= b){
			preX += X[py];
			++py;
		}
		preY %= mod, preX %= mod;
		X[i-1] = preY;
		Y[i-1] = preX;
		if(px < i){
			while(lex < i-1){
				X[lex] = 0;
				++lex;
			}
			preX = 0;
		}
		if(py < i){
			while(ley < i-1){
				Y[ley] = 0;
				++ley;
			}
			preY = 0;
		}
		if(px == i) preY += Y[i-1];
		if(py == i) preX += X[i-1];
	}
	ll ans = 0;
	trav(x, X) ans += x;
	trav(y, Y) ans += y;
	ans %= mod;
	if(ans < 0) ans += mod;
	cout << ans << endl;
}