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

int main(){
	int x,y;
	double theta=0;
	double sum_x=0;
	double sum_y=0;
	char c;
	
	while(cin >>x>> c >> y){
		if(x==0&&y==0) break;
		sum_y += x*cos(theta*M_PI/180);
		sum_x += x*sin(theta*M_PI/180);
		theta += y;
	}
	cout << (int)sum_x<<endl;
	cout <<(int)sum_y<<endl;

}