Problem: Find the number of sequences of N non-negative integers A_1, A_2, ..., A_N that satisfy the following conditions:

* L \leq A_1 + A_2 + ... + A_N \leq R
* When the N elements are sorted in non-increasing order, the M-th and (M+1)-th elements are equal.



Since the answer can be enormous, print it modulo 10^9+7.

Constraints

* All values in input are integers.
* 1 \leq M < N \leq 3 \times 10^5
* 1 \leq L \leq R \leq 3 \times 10^5

Input

Input is given from Standard Input in the following format:


N M L R


Output

Print the number of sequences of N non-negative integers, modulo 10^9+7.

Examples

Input

4 2 3 7


Output

105


Input

2 1 4 8


Output

3


Input

141592 6535 89793 238462


Output

933832916

Solution (in CPP):

Solution:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    rep(i,n){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
    k%=mod-1;
    if(k<0)k+=mod-1;
    ll ret=1;
    while(k){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return ret;
}
int main(){
    ll n,m,l,r;
    cin>>n>>m>>l>>r;
    m=n-m;
    --l;
    mod_build(1234567);
    ll ans1 = comb(n+r,r)-comb(n+l,l)+mod;
    ll ans2 = 0;
    REP(i,1,r+1){
        ll cur = 0;
        rep(j,m+1){
            if((j+n-m)*i>r)break;
            if(j%2)cur+=mod-comb(r-(n-m+j)*i+n,n)*comb(m,j)%mod;
            else cur+=comb(r-(n-m+j)*i+n,n)*comb(m,j)%mod;
        }
        rep(j,m+1){
            if((j+n-m)*i>r)break;
            if(j%2==0)cur+=mod-comb(r-(n-m)*(i+1)-j*i+n,n)*comb(m,j)%mod;
            else cur+=comb(r-(n-m)*(i+1)-j*i+n,n)*comb(m,j)%mod;
        }
        ans2+=cur%mod;
    }
    REP(i,1,l+1){
        ll cur = 0;
        rep(j,m+1){
            if((j+n-m)*i>l)break;
            if(j%2==0)cur+=mod-comb(l-(n-m+j)*i+n,n)*comb(m,j)%mod;
            else cur+=comb(l-(n-m+j)*i+n,n)*comb(m,j)%mod;
        }
        rep(j,m+1){
            if((j+n-m)*i>l)break;
            if(j%2)cur+=mod-comb(l-(n-m)*(i+1)-j*i+n,n)*comb(m,j)%mod;
            else cur+=comb(l-(n-m)*(i+1)-j*i+n,n)*comb(m,j)%mod;
        }
        ans2+=cur%mod;
    }
    ans2%=mod;
    cout<<(ans1-ans2*comb(n,m)%mod+mod)%mod<<endl;
    return 0;
}