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

#define PI (3.141592)

int main()
{
	int hosu, angle,angleplus;
	angle = 0;
	double x = 0,y=0;
	char c;
	while( cin >> hosu >> c >> angleplus ) {
		if( hosu == 0 && angleplus == 0 )
			break;
		x += hosu * sin(angle * PI / 180 );
		y += hosu * cos(angle * PI / 180 );
		angle += angleplus;
		
	}
	printf("%d\n%d\n",(int)x,(int)y);

	return 0;
}