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 <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll fact[600005];

ll extgcd(ll a,ll b,ll& x,ll& y){
	ll d=a;
	if(b!=0LL){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll mod_fact(ll n,ll p,ll& e){
	e=0;
	if(n==0)return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2!=0){
		return res*(p-fact[n%p])%p;
	}
	return res*fact[n%p]%p;
}

ll mod_comb(ll n,ll k,ll p=MOD){
	if(n<0 || k<0 || n<k)return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3)return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}


int n,m;
ll pat_over[300005];
ll pat_dist[300005];
ll base;

ll calc(int a,int b,int r){
	ll ans=0;
	for(int over=0;(ll)over*b+(ll)m*a<=r && over<=n-m;over++){
		ll rest=r-over*b-m*a;
		ll pat=pat_over[over]*pat_dist[rest]%MOD;
		if(over%2==0){
			ans+=pat;
			ans%=MOD;
		}else{
			ans+=MOD-pat;
			ans%=MOD;
		}
	}
	return ans*base%MOD;
}

int main(void){
	int l,r;
	fact[0]=1;
	scanf("%d%d%d%d",&n,&m,&l,&r);
	for(ll i=1;i<=600000;i++){
		fact[i]=fact[i-1]*i%MOD;
	}
	for(ll i=0;i<=300000;i++){
		pat_over[i]=mod_comb(n-m,i);
		pat_dist[i]=mod_comb(n+i,i);
	}
	base=mod_comb(n,m);
	ll ans=(mod_comb(n+r,r)-mod_comb(n+l-1,l-1)+MOD)%MOD;
	for(int a=1;a<=r;a++){
		ll val=calc(a,a,r)-calc(a+1,a,r);
		ll val2=calc(a,a,l-1)-calc(a+1,a,l-1);
		ans+=MOD-(val-val2+MOD)%MOD;
		ans%=MOD;
	}
	printf("%lld\n",ans);
	return 0;
}