#include <iostream>
#include <numeric>
#include <cstdlib>
using namespace std;

int main(){
	double x = 0.0;
	double y = 0.0;
	double angle = 90.0;
	for(;;){
		double hos;
		double change;
		char c;
		cin >> hos >> c >> change;
		if(hos == 0 && change == 0) break;
		x += hos * std::cos(angle * 3.14159 / 180);
		y += hos * std::sin(angle * 3.14159 / 180);
		angle -= change;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}