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

#define PI 3.141592654

using namespace std;

int main(void)
{
	double x = 0;
	double y = 0;
	int  step, d_angle;
	int  angle = 90;

	while(1)
	{
		scanf( "%d,%d",&step , &d_angle );
		if( step == 0 && d_angle == 0 ) break;

		x += step * cos((double)angle*PI/180);
		y += step * sin((double)angle*PI/180);

		angle -= d_angle;
	}

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

	return 0;
}