#include <bits/stdc++.h>
using namespace std;
#define PI acos(-1.0)

int main() {
  int d, a;
  char c;
  double x = 0.0, y = 0.0, deg = 90.0;
  while (cin >> d >> c >> a, d | a) {
    x += d * cos(deg * PI / 180.0);
    y += d * sin(deg * PI / 180.0);
    deg -= a;
  }
  cout << (int)x << "\n" << (int)y << "\n";
}
