#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 #define MOD 1000000007 //#define MOD 998244353 #define LINF (long long)4e18 #define jck 3.141592 using ll = long long; using Pi = pair; using Pl = pair; #define MAX 200000 ll fac[MAX]; ll finv[MAX]; ll inv[MAX]; void COMinit(){ fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; repr(i,2,MAX){ fac[i] = fac[i-1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD; finv[i] = finv[i-1] * inv[i] % MOD; } } int main(){ COMinit(); int d,l,r,k; cin >> d >> l >> r >> k; int l_2 = 0; int r_2 = 0; rep(i,2){ int s; if(i == 0) s = l; else s = r; while(s > 1){ s /= 2; if(i == 0) l_2++; else r_2++; } } bool ok = false; for(int i = abs(l_2-r_2); i <= l_2+r_2; i+=2){ if(i == k) ok = true; } if(!ok){ cout << 0 << endl; return 0; } ll ans = 1; rep(i,d){ if(i != l_2 && i != r_2){ ans *= fac[(int)pow(2,i)]; ans %= MOD; } } int t = (k-abs(l_2-r_2))/2; int m = pow(2,t-1); ans *= (ll)pow(2,max(l_2,r_2))*m; ans %= MOD; if(l_2 == r_2){ ans *= fac[(int)pow(2,r_2)-2]; ans %= MOD; } else{ ans *= fac[(int)pow(2,l_2)-1]; ans %= MOD; ans *= fac[(int)pow(2,r_2)-1]; ans %= MOD; } cout << ans << endl; }