#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (register ll i = (a); i <= (b); ++i)
#define per(i, a, b) for (register ll i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter cout << endl
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 1e6 + 10 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll sshwy = 1e9 + 7 ;
const double eps = 1e-7 ;
template <class T> void read(T &a)
{
	int f = 1 ; a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	a *= f;
}

ll n, m, s, l;

ll fac[maxn], inv[maxn];

ll power(ll a, ll b)
{
	ll ret = 1;
	for(; b; b >>= 1, (a *= a) %= sshwy) if(b & 1) (ret *= a) %= sshwy;
	return ret;
}

void init()
{
	ll N = maxn - 10;
	fac[0] = 1;
	rep(i, 1, N) fac[i] = fac[i - 1] * i % sshwy;
	inv[N] = power(fac[N], sshwy - 2);
	per(i, N, 1) inv[i - 1] = inv[i] * i % sshwy;
	return ;
}

ll c(ll n, ll m)
{
	return m > n ? 0 : fac[n] * inv[m] % sshwy * inv[n - m] % sshwy;
}

ll gjr(ll n, ll r)
{
	return c(n + r, n);
}

ll calc(ll n, ll s, ll a, ll b)
{
	ll ret = 0;
	ll coe = 1;
	rep(i, 0, min(n - m, (s - a * m) / (b + 1)))
	{
		(ret += coe * gjr(n, s - m * a - i * (b + 1)) * c(n - m, i) % sshwy) %= sshwy;
		ret = (ret + sshwy) % sshwy;
		// printf("Ret : %lld %lld %lld\n", n, s - m * a - i * (b + 1), ret);
		coe *= -1;
	}
	(ret *= c(n, m)) %= sshwy;
	return ret;
}

ll getans(ll n, ll m, ll lim)
{
	ll ret = 0;
	ret += gjr(n, lim);
	// printf("Ret : %lld\n", ret);
	rep(i, 1, l)
	{
		(ret -= calc(n, lim, i, i - 1)) %= sshwy;
		ret = (ret + sshwy) % sshwy;
		// printf("calc1 : %lld\n", calc(n, lim, i, i - 1));
		(ret += calc(n, lim, i + 1, i - 1)) %= sshwy;
		// printf("calc2 : %lld\n", calc(n, lim, i + 1, i - 1));
	}
	// printf("cxknmsl %lld\n", ret);
	return ret;
}

signed main()
{
	scanf("%lld %lld %lld %lld", &n, &m, &s, &l);
	init();
	printf("%lld\n", ((getans(n, m, l) - getans(n, m, s - 1)) % sshwy + sshwy) % sshwy);
	return 0;
}

Measured memory_bytes: 16000