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

typedef long double ldouble;

const ldouble PI = acos(-1.0);
const ldouble eps = 1e-12;

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

	return 0;
}