#include<cstdio>
#include<iostream>
#include<cmath>

using namespace std;
#define PI 3.1415926535897932

int main(){
	double x=0.0, y=0.0;
	int	dir=90, step, ang;
	char dmy;

	while(1){
	cin >> step >> dmy >> ang;
	if((step==0) && (ang==0)){
		cout<< (int)x << endl << (int)y << endl;
		return 0;
	}
		x+=(cos((long double)dir/180*PI)*step);
		y+=(sin((long double)dir/180*PI)*step);

		dir=(dir-ang)%360;
	}
}