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)

/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#pragma comment("-Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#define eprintf(...) 0
#else
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#endif
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){int ret=1;do{if(y&1)ret=(ll)ret*x%md;x=(ll)x*x%md;}while(y>>=1);return ret;}
inline int Rand(){return rand()*32768+rand();}
int n,x,y;
int a[100005];
struct bit{
	int f[100005],pos;
	bit(){
		memset(f,0,sizeof f);
		pos=0;
	}
	void add(int x,int v){
		x++;
		while(x<=1e5+3){
			f[x]+=v;f[x]%=mod;x+=x&-x;
		}
	}
	int sum(int x){
		x++;
		if(x<=0)return 0;
		int ret=0;
		while(x){
			ret+=f[x];ret%=mod;x-=x&-x;
		}
		return ret;
	}
	int query(int l,int r){
		return (sum(r)-sum(l-1)+mod)%mod;
	}
	void clear(int p){
		while(pos<=p){
			add(pos,mod-query(pos,pos));pos++;
		}
	}
}f,g;
int posx=1,posy=1;
int main(){
	cin>>n>>x>>y;
	for(int i=1;i<=n;i++)cin>>a[i];
	f.add(0,1);g.add(0,1);
	for(int i=2;i<=n;i++){
		while(a[i]-a[posx]>=x)posx++;
		while(a[i]-a[posy]>=y)posy++;
		//f: last X is t,cur=y
		//g: last Y is t,cur=x
		int F=g.query(0,min(posy-1,i-2));
		int G=f.query(0,min(posx-1,i-2));
		if(a[i]-a[i-1]<x)g.clear(i-2);
		if(a[i]-a[i-1]<y)f.clear(i-2);
		f.add(i-1,F);
		g.add(i-1,G);
//		for(int j=0;j<i;j++)cerr<<f.query(j,j)<<" ";cerr<<endl;
//		for(int j=0;j<i;j++)cerr<<g.query(j,j)<<" ";cerr<<endl;
	}
//	cerr<<f.query(0,n)<<" "<<g.query(0,n)<<endl;
	cout<<(f.query(0,n)+g.query(0,n))%mod<<endl;
	return 0;
}