#include <iostream>
#include <math.h>
using namespace std;

int main() {
  
  double x=0,y=0,radian;
  int toward,deg1,deg2;
  char ch;
  
  cin >> toward >> ch >> deg1;
  y += toward;
  
  while(1){
      cin >> toward >> ch >> deg2;
      if (toward==0&&deg2==0)break;
      
      radian = acos(-1) /180  * deg1;
      x += sin(radian)*toward;
      y += cos(radian)*toward;
      deg1 += deg2;
  }
  
  cout << (int)x << endl << (int)y << endl;
  return 0;
  
}