#include using namespace std; #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define mp make_pair #define all(c) (c).begin(),(c).end() #define rall(c) (c).rbegin(),(c).rend() typedef long long ll; typedef pair pii; typedef pair pll; const ll inf=1e9+7; const ll mod=1e9+7; ll depth(ll a){ ll cnt=0; while(a){ cnt++; a/=2; } return cnt; } ll e(ll d){ ll res=1; ll s=d; while(s>0){ s--; res*=2; res%=inf; } return res; } int main(){ ll d,l,r,k;cin>>d>>l>>r>>k; ll ans=1; if((depth(l)+depth(r)-k)%2||depth(l)+depth(r)-k<=0){ cout<<0<anc)ans*=e(depth(l)-anc-1); ans%=inf; ans*=2; ans%=inf; ll f=0; rep(i,d){ k=e(i); if(depth(l)!=anc&&i==depth(l)-1)k--; if(i==depth(r)-1)k--; while(k>1){ ans*=k; ans%=inf; k--; } } cout<