//0016 Treasure Hunt

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

template<class T>
T DigToRad(T x)
{
	return x / T(180) * 3.14159265358979323846264338327950;
}


int main(void)
{
	double x, y;
	double d, dd, r;
	char dummy;

	x = y = 0;
	d = 90;
	//üÍÍR}ÅæØçêÄ^¦çêé
	while(cin >> r >> dummy >> dd, r)
	{
		x += r*cos(DigToRad(d));
		y += r*sin(DigToRad(d));
		//³ÌÈçEñè
		d -= dd;

		cout << '\t' << x << '\t' << y << endl;
	}
	//®ðoÍ
	cout << (int)x << endl << (int)y << endl;
}