#include <iostream>
#include <cmath>
#include <cstdio>

#define PI 3.14159265358979323846

using namespace std;

int main(){
	double	x = 0,
		y = 0;
	int	deg = 0;
	int	p, q;
	while(scanf("%d,%d", &p, &q) && p && q){
		x += p * sin(deg * PI / 180);
		y += p * cos(deg * PI / 180);	
		deg += q;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}