#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    double x=0,y=0;
    double angle=90;
    while(true){
        double a,b;
        char c;
        cin>>a>>c>>b;
        
        if(a==0&&b==0)break;
        if(b<0){b=360+b;}
        x+=a*cos(angle*M_PI/180);
        y+=a*sin(angle*M_PI/180);
        angle-=b;
        
        
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
    
    return 0;
}

