#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int a,b;
    char c;
    double pi=acos(-1.0);
    double x=0,y=0,angle=90;
    for(;;){
       cin>>a>>c>>b;
       if(a==0 && b==0) break;
       x+=a*cos(angle*pi/180);
       y+=a*sin(angle*pi/180);
       angle-=b;      
   }
   cout<<(int)x<<"\n"<<(int)y<<endl;
   return 0;
}