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 Rust (1.15.1) (judge verdict: Wrong Answer)

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        a: usize,
        b: usize,
        v: [usize; n]
    }
    let (a, b) = (max(a, b), min(a, b));
    if n == 1 {
        println!("2");
        return;
    }
    if n == 2 && v[1] - v[0] < b {
        println!("2");
        return;
    }
    if (0..n - 1).all(|i| v[i + 1] - v[i] < b) {
        println!("0");
        return;
    }
    let d = 1000000007;
    let mut next = vec![n + 1; n];
    let mut r = 1;
    let mut ac = vec![0; n];
    for i in 0..n - 1 {
        ac[i + 1] = ac[i] + if {v[i + 1] - v[i] >= b} {0} else {1};
    }
    for i in 0..n - 1 {
        while r < n && v[r] < v[i] + a {
            r += 1;
        }
        if ac[r - 1] == ac[i + 1] {
            next[i] = r;
        }
    }
    let mut dp = vec![vec![0, 0]; n + 1];
    dp[0] = vec![1, 1];
    for i in 0..n - 1 {
        if next[i] <= n {
            dp[next[i]][0] = (dp[next[i]][0] + dp[i][0]) % d;
            dp[next[i]][1] = (dp[next[i]][1] + dp[i][0]) % d;
        }
        dp[i + 1][0] = (dp[i + 1][0] + dp[i][1]) % d;
        if v[i + 1] - v[i] >= b {
            dp[i + 1][1] = (dp[i + 1][1] + dp[i][1]) % d;
        }
    }
    println!("{}", (dp[n - 1][0] + dp[n - 1][1] + dp[n][0]) % d);
}