#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define PI acos(-1)
using namespace std;
int main(){
double x=0,y=0,ka=PI/2;
int ho,kai;
char d;
while(cin>>ho>>d>>kai,ho||kai){
x+=ho*cos(ka);
y+=ho*sin(ka);
ka-=PI/180*kai;
}
//cout<<(double)sin(0)<<endl;
cout<<(int)x<<endl<<(int)y<<endl;
}