This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
readints=lambda:map(int, input().strip('\n').split())
mod=10**9+7
n,k=readints()
def f(n,k):
if n==0: return 1
if k>(2**n)//2:
return 2*f(n-1,k-(2**n)//2)
else:
return 2*f(n-1,k)-1
res = f(n,k)
res %= mod
res += mod
res %= mod
print(res)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |