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

int main() {

  int input1,input2;
  char c;

  int ang = 0;
  double x,y;
  x = y = 0.00;

  while(true) {

    cin >> input1 >> c >> input2;
    if ( input1 == 0 && input2 == 0 ) break;

    x += sin( M_PI * ang / 180 ) * input1;
    y += cos( M_PI * ang / 180 ) * input1;

    ang += input2;

  }

  int x_i = x;
  int y_i = y;

  cout << x_i << endl << y_i << endl;
  return 0;

}