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

using namespace std;

double dig2rad(double dig){return dig*M_PI/180.0;}

int main(void){
	int step,rot;
	char delim;
	double x=0,y=0,ang=90;

	while(cin >> step >> delim >> rot,step||rot){
		x+=step*cos(dig2rad(ang));
		y+=step*sin(dig2rad(ang));
		ang-=rot;
	}
	cout << (int)x << endl << (int)y << endl;

	return 0;
}