#include <iostream>
#include <cmath>

int main(){
	const double PI=3.14159265358979;
	int x,y;
	double theta=0;
	double sum_x=0;
	double sum_y=0;
	char c;
	
	while(std::cin >> x >> c >> y){
		sum_y += x * cos(theta * PI / 180);
		sum_x += x * sin(theta * PI / 180);
		theta += y;
	}
	
	std::cout << (int)sum_x << std::endl;
	std::cout << (int)sum_y << std::endl;

}