#ifndef POINT_RADIAN_H
#define POINT_RADIAN_H

#include <iostream>
#include <cmath>

using namespace std;

static const double PI = 3.141592;


class Point{
public:
    double x, y;
    Point(double x=0, double y=0): x(x),y(y){}

    Point operator + (Point p) {return Point(x+p.x, y+p.y);}
    Point operator - (Point p) {return Point(x-p.x, y-p.y);}
    Point operator * (double a) {return Point(a*x, a*y);}
    Point operator / (double a) {return Point(x/a, y/a);}

};

int main(){
    int d, a;
    int degree(0);
    Point p;
    double radian = 0;
    
    while (scanf("%d,%d",&d, &a)){
        if(d == 0 && a == 0){
            break;
        }
        radian = degree * (PI/180);
        p.x = p.x + d * cos(radian);
        p.y = p.y + d * sin(radian);
        degree += a;

    }
    cout << static_cast<int>(p.y) << "\n";
    cout << static_cast<int>(p.x) << "\n";


}


#endif // POINT_RADIAN_H