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>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll mx;
ll fac[1000010],finv[1000010];

ll comb(ll n,ll r){
  maxch(mx,n); maxch(mx,r);
  if(n<0||r<0||n<r)return 0;
  else return ((fac[n]*finv[n-r])%mod)*finv[r]%mod;
}

ll mod_pow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll calc(ll S,ll N){
  if(S<0)return 0;
  return comb(S+N,N);
}

ll calc2(ll S,ll N,ll M,ll X,ll Y){
  ll c=comb(N,M);
  S-=(N-M)*Y;
  if(S<0)return 0;
  ll res=0;
  rep(i,M+1){
    if(S<0)break;
    ll add=comb(M,i)*c%mod;
    (add*=calc(S,N))%=mod;
    if(i%2==0) (res+=add)%=mod;
    else (res+=(mod-add))%=mod;
    S-=X+1;
  }
  return res;
}

ll N,M,L,R;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  fac[0]=1;
  rep(i,1000000)fac[i+1]=fac[i]*(i+1)%mod;
  rep(i,1000001)finv[i]=mod_pow(fac[i],mod-2);

  cin>>N>>M>>L>>R;
  M=N-M;
  ll tot=(calc(R,N)-calc(L-1,N)+mod)%mod;
  rep(X,R){
    ll Y=X+1;
    ll sub=((calc2(R,N,M,X,Y)-calc2(R,N,M,X,Y+1)+mod)%mod-(calc2(L-1,N,M,X,Y)-calc2(L-1,N,M,X,Y+1)+mod)%mod+mod)%mod;
    tot=(tot-sub+mod)%mod;
  }
  cout<<tot<<endl;

  return 0;
}