#include<iostream>
#include<math.h>
#define Pi 3.1415926535898
#define ANGLE (Pi/180.0)
using namespace std;

int main(){
	double x, y;
	int a, b;
	double angle;
	char kanma;
	cin >> a >> kanma >> b;
	angle = 0;
	while(a || b){
		x += a*sin(angle*ANGLE);
		y += a*cos(angle*ANGLE);
		angle += b;
		cin >> a >> kanma >> b;
	}
	cout << (int)(x) << endl;
	cout << (int)(y) << endl;
	return 0;
}