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