#include<bits/stdc++.h>
#define XX first
#define YY second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define REP rep
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
const ll MOD=1e9+7;

#define rall(X) (X).rbegin(),(X).rend()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}

template<ll mod>
struct ModInt{
  using M=ModInt;
  ll a;
  M& put(ll v){
    a=(v<mod)?v:v-mod;
    return *this;
  }
  ModInt(ll v=0){put(v%mod+mod);}
  M operator+(M x){return M().put(a+x.a);}
  M operator-(M x){return M().put(a+mod-x.a);}
  M operator*(M x){return M().put(a*x.a%mod);}
  M operator/(M x){return x.inv()*a;}
  M& operator+=(M x){return *this=*this+x;};
  M& operator-=(M x){return *this=*this-x;};
  M& operator*=(M x){return *this=*this*x;};
  M& operator/=(M x){return *this=*this/x;};
  bool operator==(M x){return a==x.a;}
  M pow(ll m) {
    M x=*this,res=1;
    while(m){
      if(m&1)res*=x;
      x*=x;
      m>>=1;
    }
    return res;
  }
  M inv(){return pow(mod-2);}
};
using mint = ModInt<MOD>;

int N, M, L, R;
mint fact[614514];

mint Comb(int n, int k) {
  assert(0 <= k && k <= n);
  //if (!(0 <= k && k <= n)) return 0;
  return fact[n]/fact[k]/fact[n-k];
}

mint Calc(int L) {
  auto ret = Comb(L+N, N)/fact[N];
  vector<mint> f(L+1);
  rep(l, N-M+1) {
    mint coef = Comb(N-M, l) * mint(-1).pow(l);
    for (int idx=M; idx<=L; idx+=l+M) {
      f[idx] -= coef;
    }
    for (int idx=M+l; idx<=L; idx+=l+M) {
      f[idx] += coef;
    }
  }
  rep(j, L+1) {
    int k = L-j;
    ret -= Comb(k+N, N)*f[j]/fact[M]/fact[N-M];
  }
  return ret;
}

signed main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);

  fact[0] = 1;
  reps(i, 1, 614514) {
    fact[i] = fact[i-1] * i;
  }

  cin >> N >> M >> L >> R;
  auto ans = (Calc(R) - Calc(L-1)) * fact[N];
  cout << ans.a << endl;
}
