#include<stdio.h>
#include<math.h>
#define PAI 3.1415926
#define DtoR(ang)	((ang*PAI)/180)
#define GOSA(x) (x>0?1e-5:-1.0*1e-5)

struct Pos{
	double x,y;
};

void VAdd(Pos *v1,Pos *v2){
	v1->x += v2-> x;
	v1->y += v2-> y;
}
Pos AtoV(double vsize,double ang){	//極座標を直交座標に変換
	Pos v;
	v.x = vsize*cos(ang);
	v.x += GOSA(v.x);
	v.y = vsize*sin(ang);
	v.y += GOSA(v.y);
	return v;
}
int main(){
	double vsize,ang,sum_ang = 90;
	Pos sumv = {0,0},v;
	while(~scanf("%lf,%lf",&vsize,&ang)){
		v = AtoV(vsize,DtoR(sum_ang));
		VAdd(&sumv,&v);
		sum_ang -= ang;
	}
	printf("%.0lf\n%.0lf\n",sumv.x,sumv.y);
	return 0;
}