#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


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

	while(1){
		scanf("%d,%d", &r, &ang);
		if(r == 0 && ang == 0) break;

		x += r * sin(ang*M_PI/180);
		y += r * cos(ang*M_PI/180);
	}

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

	return 0;
}