This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
MOD = 10**9 + 7
def solve():
n, k = map(int, input().split())
k -= 1
ans = 1
for i in range(n):
if (k % 2 == 0):
ans = (2*ans) % MOD
else:
ans = (2*ans + 1) % MOD
k //= 2;
pow2 = 1
for i in range(n):
pow2 = (2*pow2) % MOD
print((ans - pow2 + 1) % MOD)
solve()
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |