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

int main() {
	double x=0, y=0;
	double a, b;
	double c=90;
	while (scanf("%lf,%lf", &a, &b)&&a!=0&&b!=0) {
		x += cos(c*3.14159265/180)*a;
		y += sin(c*3.14159265/180)*a;

		c =90- b;
	}
	x = floor(x);
	y = floor(y);
	cout << x <<' '<< y << endl;

	return 0;
}