#include<iostream>
#include<cmath>
using namespace std;
#define pi 3.14


int main()
{
	int x = 0, y = 0;
	double d = 0, a = 90, r;
	while (d != 0 || r != 0) {
		cin >> d >> r;
		x = x + d * cos(a / 2 / pi);
		y = y + d * sin(a / 2 / pi);
		a = a + r;
	}
	cout << x << endl << y << endl;
    return 0;
}


