#include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979

int main(void)
{
	int i=0,a,b,k=90;
	double x=0,y=0;

	while(i == 0)
	{
		scanf("%d,%d",&a,&b);

		if(a == 0 || b == 0)break;

		x += cos(k * M_PI / 180)*a;
		y += sin(k * M_PI / 180)*a;
		k -= b;
	}
  printf("%d\n%d\n",(int)x,(int)y);

  return 0;
}