#include<iostream>
#include<cmath>

const double rad = (3.14159265 / 180);

int main(){

	int m, angle, sumangle = 0;
	double x = 0, y = 0;

	char c;

	while (std::cin >> m >> c >> angle, m || angle){

		x += (std::cos((90 - sumangle)*rad)*m);
		y += (std::sin((90 - sumangle)*rad)*m);
		sumangle += angle;
	}

	std::cout << (int)x << std::endl << (int)y << std::endl;

	return 0;
}