#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll MOD=1e9+7;
ll n;
ll calc(ll act, ll lvl, ll pos)
{
if(lvl==n)
return pos%MOD;
if(act%2!=0)
return calc(act/2,lvl+1,(pos*2)%MOD);
return calc(act/2,lvl+1, (pos*2-1)%MOD);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll k, tam, act;
cin >> n >> k;
act=k-1;
cout << calc(act, 0, 1);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |