#include<iostream>
#include<math.h>
using namespace std;

int main(){
	double x,y,dx,dy,pi,d,rad,prad;
	char camma;
	x=y=0;
	pi=3.14159265359;
	prad=90;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos(prad*pi/180);
		dy=d*sin(prad*pi/180);
		x+=dx;
		y+=dy;
		prad=prad-rad;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	return 0;
}