#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;

const double pi = 3.14159265358;
int main()
{
	double x = 0.0, y = 0.0, angle = 0.0;

	while(1)
	{
		double walk, turn;
		char cn;
		cin >> walk >> cn >> turn;

		if(!walk && !turn) break;

		x += walk * sin( angle * pi * ((double)1/180) );
		y += walk * cos( angle * pi * ((double)1/180) );

		angle += turn;

	}
	printf("%d\n%d\n", (int)x, (int)y);
}