#include <iostream>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>
using namespace std;
int main() {
  double x, y, walk, deg, rad = M_PI_2;
  char c;
  while (cin >> walk >> c >> deg) {
    if (walk == 0 && deg == 0) break;
    x += walk * cos(rad);
    y += walk * sin(rad);
    rad -= deg * M_PI / 180;
  }
  cout << (int) x << endl << (int) y << endl;
}