#include<iostream>
#include<cmath>
#define PI 3.141592653589793
using namespace std;

int main(){
	double x = 0, y = 0;

	int l, a;

	while(scanf("%d,%d",l,a) != -1){
		x += l * cos(a * PI / 180);
		y += l * sin(a * PI / 180);
	}

	cout << (int)x << endl << (int)y << endl;

	return 0;
}