#include <stdio.h>
#include <math.h>

int main(void)
{
	int step, a, tmp = 0;
	double x = 0.0, y = 0.0;
	
	while(scanf("%d,%d", &step, &a) != EOF && (step != 0 || a != 0)){
		
		x += step * (sin((tmp * 3.14159) / 180.0));
		y += step * (cos((tmp * 3.14159) / 180.0));
		tmp += a;
	}
	
	printf("%d\n", (int)x);
	printf("%d\n", (int)y);
	
	return 0;
}