mod=10**9+7
def power(a, b):
if(b == 0): return 1
if(b % 2): return power(a, b - 1) * a % mod
else:
y = power(a, b // 2)
return y * y % mod;
def rec(i,j):
if i == 0:return 1
if j%2 == 0:
return rec(i-1,j//2)+power(2,i-1)
else:
return rec(i-1,j//2+1) % mod
n,k=map(int,input().split())
print(rec(n,k))
Compilation message (stdout)
Compiling 'rack.py'...
=======
adding: __main__.pyc (deflated 42%)
=======
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |