#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
signed main(){
    double a,b;
	double now=0;
	double nx=0,ny=0;
	while(true){
		scanf("%lf,%lf",&a,&b);
		if(a==0&&b==0){
            cout<<(int)nx<<endl<<(int)ny<<endl;
            ggr;
        }
		nx+=a*sin(now/180*pie);
		ny+=a*cos(now/180*pie);
		now+=b;
	}
    ggr;
}
