#include<iostream>
#include<cmath>
#define rad(x) (x * 3.141592653589793) / 180
using namespace std;

int main(void){
  int m, n;
  int ansx,ansy;
  char chr;
  double x = 0, y = 0, a = 90.0;

  while(cin >> m >> chr >> n , m != 0 || n != 0){
    x += cos(rad(a)) * m;
    y += sin(rad(a)) * m;
    a -= n;
    if(a < 0)
      a += 360;
    if(a >= 360)
      a -= 360;
  }
  
  ansx = x;
  ansy = y;
  cout << ansx << endl << ansy << endl;
  return 0;
}