N, M, D1, D2 = map(int, input().split()) MOD = 10**9 + 7 num = 2*10**6 frac = [1] * num inv_frac = [1] * num for i in range(2, num): frac[i] = (frac[i-1] * i) % MOD inv_frac[-1] = pow(frac[-1], MOD-2, MOD) for i in range(num-1, 0, -1): inv_frac[i-1] = (inv_frac[i] * i) % MOD def comb(n, r): if r < 0 or r > n: return 0 return (frac[n] * (inv_frac[n-r] * inv_frac[r])%MOD) % MOD def calc(n, m): # 合計 m個を n人で分ける # n人それぞれの最小個数は0個 # {m+1}_H_{n-1} = {m+n-1}_C_{n-1} return comb(n+m-1, n-1) M = M - 1 - D1*(N-1) ans = calc(N+1, M) for k in range(1, N): m = M - (D2-D1+1)*k ans += (-1)**(k%2) * comb(N-1, k) * calc(N+1, m) ans %= MOD print(ans)