#38864: 奇怪的答案


yp11251144@yphs.tp.edu.tw (911-38曾湛)


#include<iostream>
#include<iomanip>
using namespace std;
 
int main()
{
int x=0,y=0,a,k,n;
cin>>n;
while(n--){
 
while(cin>>a>>k){
if(n==0) cout<<x<<" "<<y<<endl;
if(a==0) y=y+k;
else if(a==1) x=x+k;
else if(a==2) y=y-k;
else x=x-k;
}
}
cout<<x<<" "<<y<<endl;
 
}