from bisect import bisect_left MOD = 1000000000 + 7 d,l,r,k = map(int,input().split()) pow2 = [] acc = [] fac = [] pow2.append(1) pow2.append(1) for i in range(2,21): pow2.append(pow2[-1]*2) acc.append(0) acc.append(1) for i in range(2,21): acc.append(acc[-1]+pow2[i]) fac.append(1) fac.append(1) for i in range(2,pow2[20]+1): fac.append((fac[-1]*i)%MOD) l = bisect_left(acc,l) r = bisect_left(acc,r) lca = -1 ans = 1 if l + r - k > 1 and (l + r -k)%2 == 0: lca = (l + r -k) //2 if lca == -1 or lca > l or lca > r: ans = 0 for i in range(1,d+1): cnt = pow2[i] if i == l: cnt-=1 if i == r: cnt-=1 ans *= fac[cnt] ans %= MOD if ans != 0: ans *= pow2[lca] ans %= MOD ans *= pow2[l - lca] ans %= MOD ans *= pow2[r - lca] ans %= MOD ans *= 2 ans %= MOD print(ans)