#include<iostream> using namespace std; int main(){ long long int a,b,c,n; while(cin>>n){ while(cin>>a>>b>>c){ a>1<=4; if(a==1){ cout<<b+c<<endl; } else if(a==2){ cout<<b-c<<endl; } else if(a==3){ cout<<b*c<<endl; } else cout<<b/c<<endl; } } return 0; }
//最基礎的解法