mod = 10 ** 9 + 7 D, L, R, K = map(int, input().split()) dl = L.bit_length() dr = R.bit_length() for lca in range(1, dl + 1): if dr + dl - 2 * lca == K: break else: print(0) exit() ans = pow(2, lca - 1, mod) if dl == lca: ans *= pow(2, dr - lca, mod) ans %= mod else: ans *= pow(2, dl - lca, mod) ans *= pow(2, dr - lca - 1, mod) ans %= mod cnt = [1 << i for i in range(D)] cnt[dl - 1] -= 1 cnt[dr - 1] -= 1 for c in cnt: for i in range(2, c + 1): ans *= i ans %= mod print(ans)