#include <iostream>
using namespace std;

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