#include<iostream>
#include<math.h>
#define PI 3.14159265358979
using namespace std;
int main(void){
    double d,a,x=0,y=0,degree=90;
    char c;
    while(cin >> d >> c >> a){
        if(d==0 && a==0)  break;
        x=x+cos(PI*degree/180)*d;
        y=y+sin(PI*degree/180)*d;
        degree=degree-a;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
}
