#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>

#define rep(x,to) for(x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;
int main(void){

int ho,ka;
char mz;
double x=0,y=0,oka;
double pi=3.141519;
	oka=0;
	while(cin >> ho >>mz >> ka){
		if(ho == 0 && ka == 0) break;
		x += sin(oka*pi/180) * ho;
		y += cos(oka*pi/180) * ho;
		oka += ka;
	}
	cout << (int)x <<endl;
	cout << (int)y <<endl;
	
	return 0;
}