#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
	double x = 0, y = 0, a, b, agl = 90, rad = 3.14159265358998 / 180;

	while(1){
		scanf("%lf,%lf", &a, &b);
		if(a == 0 && b == 0)    break;

		x += a * cos(rad * agl);
		y += a * sin(rad * agl);

		agl -= b;
	}

	cout << int(x) << endl << int(y) << endl;

	return 0;
}