#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}

using namespace std;
int main() {
    double x=0,y=0,theta=0;
    double a,b;
    scanf("%lf,%lf",&a,&b);
    while(a||b){
        y += a*cos(rad(theta));
        x += a*sin(rad(theta));
        theta += b;
        scanf("%lf,%lf",&a,&b);
    }
    x = (abs(x)<=(1e-9))?0:x;
    y = (abs(y)<=(1e-9))?0:y;
    printf("%.0lf %.0lf",x,y);
    return 0;
}