#include <iostream>
#include <cmath>
#define PI 3.14159265358979323846
using namespace std;

double DegToRad(int);

int main(){
	char c;
	double deg=90,x,y,walk,rotate;
	while(cin>>walk>>c>>rotate){
		if( walk==0&&rotate==0 ) break;
		x+=walk*cos(DegToRad(deg));
		y+=walk*sin(DegToRad(deg));
		deg-=rotate;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	return 0;
}

double DegToRad(int deg){
	return PI*deg/180.0;
}