#include <iostream>
#include <cmath>

using namespace std;
#define PI 3.141592

int main()
{
	int value,value_2;
	char c;
	double x=0.0,y=0.0,angle = 90;

	while(cin >> value >> c >> value_2)
	{
		if(value == 0 && value_2 == 0) break;

		x += cos(angle*PI/180)*value;
		y += sin(angle*PI/180)*value;
		angle -= value_2;
	}
	cout << (int)x << endl << (int)y << endl;
}