#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	int angle = 90;
	double x = 0,
		   y = 0;

	double d, a;
	char c;
	while (cin >> d >> c >> a) {
		//cout << "d:" << d << ' ' << "a:" << a << endl;

		double dx, dy;
		dx = cos(angle * PI / 180) * d;
		dy = sin(angle * PI / 180) * d;

		x += dx;
		y += dy;

		angle -= a;
	}

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