//Aizu - 0016 : Treasure Hunt
#include<stdio.h>
#include<math.h>

const double PI = acos(-1.0);
const double eps = 1e-8;

int main()
{
	double d,t;
	double x=0,y=0;
    double dir = 0.0;
	while(scanf("%lf%*c%lf",&d,&t)&&d!=0&&t!=0)			//霎灘?0,0扈捺據
	{
	    while(dir - 360 > -eps) dir -= 360;
	    while(dir < -eps) dir += 360;
		x += d*sin((dir) / 180.0 * PI);						//隶。邂?		y += d*cos((dir) / 180.0 * PI);
	    dir += t;
	}
    int ox, oy;
    ox = x, oy = y;
	printf("%d\n%d\n", ox, oy);					//霎灘?

	return 0;
}