#include using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair pii; typedef pair pll; typedef pair pdd; const ull mod = 1e9 + 7; #define REP(i,n) for(int i=0;i<(int)n;++i) //debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; template ostream& operator << (ostream& os, const pair v){ os << "(" << v.first << ", " << v.second << ")"; return os; } template ostream& operator << (ostream& os, const vector v){ for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os; } template ostream& operator << (ostream& os, const vector> v){ for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os; } ll fact[2020202]; ll powLL(ll a, ll n){ ll res = 1; while(n>0){ if(n&1){ res *= a; } a = a*a; n >>= 1; } return res; } int main(){ cin.tie(0); ios::sync_with_stdio(false); fact[0] = 1; REP(i, 2020201){ fact[i+1] = fact[i]*(i+1); fact[i+1] %= mod; } ll d, l, r, k; cin >> d >> l >> r >> k; ll L=0, R=0; while(l>0){ l /= 2; L++; } while(r>0){ r /= 2; R++; } if(L>R) swap(L, R); ll res = 1; ll now = 1; if(k>=R-L && k<=R+L-2 && (k-(R-L))%2==0){ ll t = (k - (R-L))/2; //dump(t) REP(i, d){ if(i==L-1){ if(R==L){ res *= now; res %= mod; res *= (1ll<<(t-1)); res %= mod; res *= fact[now-2]; res %= mod; }else{ if(t != 0){ res *= (1ll<<(t-1)); res %= mod; } res *= fact[now-1]; res %= mod; } }else{ res *= fact[now]; } res %= mod; now *= 2; } }else{ res = 0; } cout << res << endl; return 0; }