#include <stdio.h>
#include <math.h>

#define PI 3.14159265

int main(void){
    double x,y,curAn;
    int theta, r;
    
    x = y = 0;
    curAn = 0;
    while (scanf("%d,%d", &r, &theta)){
        if (theta==0 && r==0) break;
        x -= r*cos(curAn);
        y += r*sin(curAn);
        curAn = theta * 2 * PI /360.0;
    }
    printf("%d\n%d\n", (int)x, (int)y);
    return 0;
}