#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define PI 3.141592
using namespace std;

int main(void){

    double x=0,y=0;
    int a,b;
    int q=90;
    char z;
    for(;;){
    scanf("%d%c%d",&a,&z,&b);
        if(a==0&&b==0)break;
        y += a*sin(((double)q/180)*3.141592);
        x += a*cos(((double)q/180)*3.141592);
        q -= b;
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
    return 0;
}