#include<iostream>
#include<cmath>
using namespace std;
double a, b; int c, d; char f;
int main() {
	while (cin >> c >> f >> d) {
		a += 1.0*sin(d) * c;
		b += 1.0*cos(d) * c;
	}
	cout << (int)a << endl << (int)b << endl;
}