
#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_r = M_PI_2;
	int x,r; char c;
	while(cin>>x>>c>>r,(x||r)){
		P add = P(x,0) * P(cos(c_r),sin(c_r));
		p += add;
		c_r -= r / 180.0 * M_PI;
	}

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

	return 0;
}