#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

#define Pai 3.141592653589793
int main(void)
{
	double x=0,y=0,l=90,n,m;
	
	while(1){
		scanf("%lf,%lf",&n,&m);
		if (n==0&&m==0) {
			break;
		}
		y+=n*sin((double)l*Pai/180);
		x+=n*cos((double)l*Pai/180);
		l-=m;
	}
	printf("%.0f\n%.0f\n",x,y);
	
	return (0);
}