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

int main(){
	//hosuu = üÍ³êéà, kakudo = üÍ³êépx
	//x = »Ýn_ÌxÀW, y = »Ýn_ÌyÀW, rad = ¡ü¢Ä¢épx(WA)
	int hosuu, kakudo;
	double x = 0.0, y = 0.0, rad = 0.0;
	while(scanf("%d,%d", &hosuu, &kakudo)){
		if(hosuu == 0 && kakudo == 0) break;
		
		//x = hosuu * sin(kakudo), y = hosuu * cos(kakudo)
		x += (hosuu * sin(rad));
		y += (hosuu * cos(rad));
		
		//Éü­pxðwè(WAÉ¼·)
		rad += kakudo * PI / 180.0;
		
	}
	cout <<(int)x <<endl <<(int)y <<endl;
	return 0;
}