MOD = 10 ** 9 + 7 INF = 10 ** 10 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) def main(): d,l,r,k = map(int,input().split()) dl,dr = 0,0 while 2 ** (dl + 1) <= l: dl += 1 while 2 ** (dr + 1) <= r: dr += 1 if dr + dl - k < 0 or (dr + dl - k)%2 == 1 or dr - dl > k: print(0) return lca = (dr + dl - k)//2 if dl == lca: ans = pow(2,dl) * pow(2,dr - lca) % MOD else: ans = pow(2,dl) * pow(2,dr - lca - 1) % MOD #print(dl,dr,lca,ans) for i in range(d): t = pow(2,i) if i == dr and i == dl: t -= 2 elif i == dr or i == dl: t -= 1 for j in range(1,t + 1): ans *= j ans %= MOD print(ans) if __name__ =='__main__': main()