#include<iostream>
#include<stdio.h>
#include<math.h>
#define PI (3.14159265)
using namespace std;

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

	while ( scanf( "%lf,%lf", &dis, &deg ), dis + deg ){
		x -= dis * sin( sdeg );
		y += dis * cos( sdeg );
		
		deg = deg * PI / 180.0;
		sdeg -= deg;
	}
	cout << (int)x << endl << (int)y << endl;
	
	return 0;
}