#include<iostream>
#include<math.h>
#include<cstdio>

#define PI 3.141592653589793

using namespace std;

int main(){
	int dis,deg;
	double x,y,rad;
	char con;
	x=y=0;
	rad+= 90 * PI / 180.0;;
	while(cin>>dis>>con>>deg,dis|deg){
		x+=dis*cos(rad);
		y+=dis*sin(rad);
		rad+= deg * PI / 180.0;;
	}
	cout<<-(int)x<<endl<<(int)y<<endl;
}