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

int main()
{
	int d, a;
	char s;
	double x = 0, y = 0, ap = 90, xi, yi;

	cin >> d >> s >> a;

	while (d != 0 || a != 0) {
		x += d * cos(ap / 180 * 3.14159);
		y += d * sin(ap / 180 * 3.14159);
		
		ap -= (double)a;
		
		cin >> d >> s >> a;
	}

	modf(x, &xi);
	modf(y, &yi);

	cout << xi << endl;
	cout << yi << endl;

	return 0;
}
