#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;

int main() {
  int w;
  double ang = M_PI/2; int angInt;
  char c;
  double x = 0.0, y = 0.0;

  while(cin>>w>>c>>angInt, w != 0 && angInt != 0) {
    x += w * cos(ang), y += w * sin(ang);
    ang -= angInt*M_PI/180.0;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}