#include using namespace std; using ll = long long; const ll MOD = 1000000007; ll modpow(ll x, ll n, ll mod = MOD) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % mod; x = x * x % mod; n >>= 1; } return res; } ll depth(ll x) { ll hoge = 1; ll ans = 0; while (x >= hoge) { ans++; hoge <<= 1; } return ans; } ll f[1 << 20]; int main() { cin.tie(0); ios::sync_with_stdio(false); ll d, l, r, K; cin >> d >> l >> r >> K; ll ld = depth(l); ll rd = depth(r); ll hoge = rd - ld; ll maxk = hoge + 2 * (ld - 1); if (K == 0 || K < hoge || K > maxk || (K - hoge) % 2 == 1) { cout << 0 << "\n"; return 0; } ll foo = (K - hoge + 1) / 2; foo = (foo >= 2 ? (1 << (foo - 1)) : 1); ll ans = foo * (1LL << (rd - 1)) % MOD; f[0] = 1; for (int i = 1; i < (1 << d); i++) { f[i] = f[i - 1] * i % MOD; } for (int i = 1; i <= d; i++) { (ans *= f[(1 << (i - 1)) - (i == ld) - (i == rd)]) %= MOD; } cout << ans << "\n"; return 0; }