#include <iostream>
#include <math.h>
using namespace std;
const double pi=acos(-1);
int main(){
    double x=0,y=0,a,d;
    bool f;
    int ang=90,p;
    string s;
    while(true){
        cin>>s;
        for(a=d=p=0;s[p]!=',';p++)a=a*10+s[p]-'0';
        p++;
        f=s[p]=='-';
        if(!f)d=s[p]-'0';
        while(++p<s.size())d=d*10+s[p]-'0';
        if(f)d=-d;
        if(a==0&&d==0)break;
        x+=a*cos(ang*2*pi/360);
        y+=a*sin(ang*2*pi/360);
        ang-=d;
    }
    cout<<(int)x<<endl<<(int)y<<endl;
}
