#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ int o,x,p; cin >> o >> x >> p; if(o == 1){ cout << (x << p) << endl; } else{ cout << (x >> p) << endl; } } return 0; }