
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	P p;
	double c_th = 90;
	double r,th; char c;
	while(cin>>r>>c>>th,(r||th)){
		P add = P(r,0) * P(cos(c_th * M_PI / 180),sin(c_th* M_PI / 180));
		p += add;
		c_th -= th;
	}

	cout << (int)p.real() << " " << (int)p.imag() << endl;

	return 0;
}