#include<iostream>
#include<cmath>
#define _USE_MATH_DEFINES
#include<math.h>

using namespace std;

int main() {
	int dis, deg, theta=90;
	double x = 0, y = 0;
	char d;
	while (true) {
		cin >> dis >> d >> deg;
		if (dis == 0 && deg==0 ) {
			break;
		}
		else {
			x += dis * cos(theta*M_PI/180);
			y += dis * sin(theta*M_PI/180);
		}
		theta -= deg;


	}
	x = int(x);
	y = int(y);
	cout << x << endl;
	cout << y << endl;
}
