n,m,l,r=map(int,input().split()) M=10**9+7 L=10**6 fa=[1,1] fb=[1,1] for i in range(2,L+1): fa+=[fa[-1]*i%M] fb+=[fb[-1]*(M//i)*fb[M%i]*fa[M%i-1]*(-1)%M] c=lambda n,k:fa[n]*fb[k]*fb[n-k]%M if n>=k else 0 a=0 for i in range(m-(1+l*(n-1))+1): if (m-(1+l*(n-1))-i)%(r-l+1)==0 and (m-(1+l*(n-1))-i)//(r-l+1)<=n-1: a+=((-1)**(i%2))*c(n+1-1+i,i)*((-1)**(((m-(1+l*(n-1))-i)//(r-l+1))%2))*c(n-1,(m-(1+l*(n-1))-i)//(r-l+1)) a%=M print(a)