#include int ri() { int n; scanf("%d", &n); return n; } #define MOD 1000000007 int solve() { int d = ri(); int l = ri(), r = ri(), k = ri(); int l_depth = 0; for (int cur = 2; cur <= l; cur <<= 1) l_depth++; int r_depth = 0; for (int cur = 2; cur <= r; cur <<= 1) r_depth++; if (l_depth > r_depth) std::swap(l_depth, r_depth); if (l_depth + r_depth < k) return 0; if ((l_depth + r_depth - k) & 1) return 0; if (k < r_depth - l_depth) return 0; int lca_depth = (l_depth + r_depth - k) >> 1; int res = 1; for (int i = 0; i < d; i++) { int num = 1 << i; if (l_depth == i) num--; if (r_depth == i) num--; for (int j = 1; j <= num; j++) res = (int64_t) res * j % MOD; } for (int i = 0; i < lca_depth; i++) res = res * 2 % MOD; l_depth -= lca_depth; r_depth -= lca_depth; if (!l_depth) for (int i = 0; i < r_depth; i++) res = res * 2 % MOD; else { for (int i = 0; i < l_depth + r_depth - 1; i++) res = res * 2 % MOD; } return res; } int main() { std::cout << solve() << std::endl; return 0; }