#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<cstdio>
using namespace std;

int main(){
	
	double x=0,y=0;
	int r=90;
	int a,b;
	char cn;
	while(cin>>a>>cn>>b){
	if(a!=b!=0){
		double s=r*M_PI/180;
		x+=a*(-cos(s));
		y+=a*sin(s);
		if(r+b<0)
			r=360-r-b;
		else if(r+b>360)
			r=r+b-360;
		else
			r=r+b;
	}
	else
		break;
	}
	int x1=x,y1=y;
	cout<<x1<<endl<<y1<<endl;
		
	
}