import sys readline = sys.stdin.readline mod = 10**9+7 def frac(limit): frac = [1]*limit for i in range(2,limit): frac[i] = i * frac[i-1]%mod fraci = [None]*limit fraci[-1] = pow(frac[-1], mod -2, mod) for i in range(-2, -limit-1, -1): fraci[i] = fraci[i+1] * (limit + i + 1) % mod return frac, fraci frac, fraci = frac(1341398) def check(dl, dr, D, K): if dl > dr: dl, dr = dr, dl dist = dr - dl if dist > K: return 0 if (K - dist) % 2 == 1: return 0 if dl - (K-dist)//2 < 1: return 0 if dl == dr == 1: return 0 par = dl - (K-dist)//2 if dl == par: return 1 if dl == dr: return pow(2, dr-par-1, mod) * pow(pow(2, dr-1, mod) -1, mod-2, mod) else: return pow(pow(2, par - 2, mod), mod-2, mod) D, L, R, K = map(int, readline().split()) dl = L.bit_length() dr = R.bit_length() ans = 1 for i in range(D): ans = ans*frac[pow(2, i)]%mod print(ans*check(dl, dr, D, K) %mod)