#define _CRT_SECURE_NO_WARNINGS 1

#include <cmath>
#include <stdio.h>

using namespace std;

int main()
{
	double X = 0; double Y = 0;

	int R = -1, THETA = -1;

	while (scanf("%d,%d", &R, &THETA))
	{
		if (R == 0 && THETA == 0)
		{
			goto Exit;
		}

		X += R * cos(THETA);
		Y += R * sin(THETA);
	}

Exit:;

	printf("%d %d", static_cast<int>(X), static_cast<int>(Y));

	return 0;
}