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

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