#include<cstdio>
#define _USE_MATH_DEFINES
#include<cmath>
#include<algorithm>

using namespace std;
int main(void)
{
	double x = 0,y = 0;
	double hosu,kakudo;
	double kakudos = 0;
	char kari;
	while(scanf("%lf%c%lf",&hosu,&kari,&kakudo))
	{
		if(hosu == 0 && kakudo == 0) break; 
		x += cos(kakudos * M_PI / 180) * hosu;
		y += sin(kakudos * M_PI / 180) * hosu;
		printf("%lf\n",cos(kakudos * M_PI / 180) * hosu);
		kakudos += kakudo;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}