#include #include #include #include #include #include #include #include #include #include #define mkp make_pair #define mkt make_tuple #define rep(i,n) for(int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const ll MOD=1e9+7; #define MAX_N 2000010 ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10]; void setComb(){ inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1; for(int i=2;i>D>>L>>R>>K; setComb(); int N=(1< A(D+1,1); for(int i=0;i=K){ int r=-1; int o=y-x; for(int i=x;i>=1;i--){ if(o==K) r=i; o+=2; } if(r==-1){ cout<<0<0) t=t*(1<<(x-r-1))%MOD; t=t*A[y-1]%MOD; t=t*A[x-1]%MOD; t=t*inv[(1<<(x-1))]%MOD; t=t*inv[(1<<(y-1))]%MOD; res=res*t%MOD; }else{ ll t=(1<<(y-1))*(1<<(x-r-1))%MOD; t=t*A[y-1]%MOD; t=t*inv[(1<<(x-1))]%MOD; t=t*inv[(1<<(y-1))-1]%MOD; res=res*t%MOD; } }else{ res=res*A[y-1]%MOD; } cout<<(res+MOD)%MOD<