#include <iostream>
#include <cstdio>
#include <cmath>

#define ANGLE (M_PI/180.0)
using namespace std;
int main(void) {
  int walk, dir;
  double x = 0.0, y = 0.0, angle = 0.0;
  char c;

  while(cin >> walk >> c >> dir, walk != 0 && dir != 0) {
    x += (double)walk * sin(angle * ANGLE);
    y += (double)walk * cos(angle * ANGLE);
    angle += (double)dir;
  }
  cout << (int)x << endl << (int)y << endl;
  return 0;
}