#include<iostream>
#include<cmath>
using namespace std;

int main()
{
	int x=0,y=0,tmp_y = 0;
	double X=0,Y=0;
	char dummy;
	while(cin >> x >> dummy >> y){
		if(!x && !y)break;

		X += x*cos(tmp_y*3.14/180);
		Y += x*sin(tmp_y*3.14/180);

		tmp_y = y;
	}

	cout << X << endl << Y << endl;

	return 0;
}