#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define PI 6*asin(0.5)

int main(){
	double x=0,y=0;
	int a,b;
	char t;
	int spin=90;
	//cout<<cos(90/180)<<" "<<sin(90/180)<<endl;
	cin>>a>>t>>b;
	while(!(a==0&&b==0)){
		x+=a*cos(spin*PI/180.0);
		y+=a*sin(spin*PI/180.0);
		spin-=b;
		//cout<<cos(spin/180.0)<<" "<<sin(spin/180.0)<<endl;
		cin>>a>>t>>b;
		//cout<<x<<" "<<y<<endl;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}