#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x=0,y=0,vec=90,dis,angle;
  for(;;){
    scanf("%lf,%lf",&dis,&angle);
    if(dis == 0 && angle == 0){break;}
    x+=dis*cos(vec*M_PI/180.0);
    y+=dis*sin(vec*M_PI/180.0);
    vec-=angle;
  }
  cout <<(int)x<<endl<<(int)y<<endl;
  return 0;
}