#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<cmath>

#define add push_back
#define inf 2147000000
#define pi 3.1415926535

#define rep(i,n) for(int i=0;i<n;i++)
#define out(a) cout<<a<<endl;

using namespace std;

int main(void){
	double x,y,kk=pi/2;
	string str;
	char* bin;
	x=0;y=0;
	while(1){
		cin>>str;
		int t = str.find(',');
		string st1 = str.substr(0,t);
		string st2 = str.substr(t+1);
		
		double a1,a2;
		bin = &st1[0];
		a1=atoi(bin);
		bin = &st2[0];
		a2=atoi(bin);
		
		if(a1==0 && a2==0){
			break;
		}
		x+=cos(kk)*a1;
		y+=sin(kk)*a1;
		
		kk-=(double)a2/180*pi;
	}
	printf("%.0lf\n%.0lf\n",x,y);
}