#include <stdio.h>
#include <iostream>
#include <math.h>

#define PI 3.1415926535897932

using namespace std;

int main() {
	int hosu;
	int kaku1 = 90;
	int kaku2;
	char a;
	double kita = 0.0;
	double higasi = 0.0;

	while(1) {
		cin >> hosu >> a >> kaku2;

		if(hosu == 0 && kaku2 == 0) {
			break;
		}

		kita += hosu * sin(PI * (double)kaku1 / 180.0);
		higasi += hosu * cos(PI * (double)kaku1 / 180.0);

		kaku1 += kaku2;
	}

	cout << -(int)higasi << endl << (int)kita << endl;

	return 0;
}