#include <stdio.h>
#include <math.h>
int main()
{
    double d,a,s,x,y;
    x = 0.0;
    y = 0.0;
    s = M_PI/2;
    while(scanf("%lf,%lf",&d,&a) != EOF){
        x -= d*cos(s);
        y += d*sin(s);
        s += a/180*M_PI;
    }
    int ax = x;
    int ay = y;
    printf("%d\n%d\n",ax,ay);
    return 0;
}

