#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <string>
#include <sstream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


double deg2rad(int deg){
	return M_PI * deg / 180;
}

int main(int argc, char **argv){
	int d = 0;
	int a = 0;
	char tmp = 0;
	double x = 0;
	double y = 0;
	int theta = 90;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

	for(;;){
#if INPUT_FROM_FILE
		ifs >> d >> tmp >> a;
#else
		std::cin >> d >> tmp >> a;
#endif
		if(d == 0 && a == 0) { break; }

		x += d * cos(deg2rad(theta));
		y += d * sin(deg2rad(theta));

		theta -= a;
	}
	std::cout << int(x) << std::endl;
	std::cout << int(y) << std::endl;
	return 0;
}
