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