#include <stdio.h>
#include <math.h>
using namespace std;

int main()
{
	double x = 0, y = 0;
	int d = 90;
	int a, b;

	while (true)
	{
		scanf("%f,%f", &a, &b);
		if (a + b == 0) break;
		x += a * cos(d * 3.14159 / 180);
		y += a * sin(d * 3.14159 / 180);
		d -= b;
	}
	printf("%d\n", x);
	printf("%d\n", y);

	return 0;
}