#include<stdio.h>
#include<math.h>
#define PAI 3.1415926
#define DtoR(ang)	((ang*PAI)/180)

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);
	//if(v.x>0)v.x -= 1e-6;
	//else if(v.x < 0)v.x += 1e-6;
	v.y = vsize*sin(ang);
	//if(v.y>0)v.y -= 1e-6;
	//else if(v.y < 0)v.y += 1e-6;
	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;
	}
	if(sumv.x>0)v.x += 1e-5;
	else if(sumv.x < 0)v.x -= 1e-5;
	if(v.y>0)v.y += 1e-5;
	else if(v.y < 0)v.y -= 1e-5;
	int x = sumv.x;
	int y = sumv.y;
	printf("%d\n%d\n",x,y);
	return 0;
}