#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define quick ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int inf = 0x3f3f3f3f, maxn = 2e5 + 5, mod = 998252334;
inline int read() {
int s = 0, w = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')s = s * 10 + ch - '0', ch = getchar();
return s * w;
}
void solve() {
int o,x,p;
o=read();x=read();p=read();
if(o==1){
for(int i=1;i<=p;i++){
x<<=1;
}
}else if(o==2){
for(int j=1;j<=p;j++){
x>>=1;
}
}
cout<<x<<endl;
}
signed main() {
int t = 1;
cin>>t;
while (t--) {
solve();
}
return 0;
}