#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  double ln,cta,x=0,y=0,angle=90.0;

  while(1){

  scanf("%lf,%lf",&ln ,&cta);
  if(ln==0&&cta==0)break;

  x += ln*cos((angle/180)*M_PI);
  y += ln*sin((angle/180)*M_PI);
  angle-=cta;
  }
  cout<< (int)x <<"\n"<< (int)y <<endl;

  return 0;
}