#include<iostream>
#include<cmath>
using namespace std;
double angle(int n){
  return n * (3.14159265358979/180);
}
int main(){
  int l,r,n=0;
  double x,y;
  x = y = 0;
  char c;
  while(cin>>l>>c>>r){
    if(l==0&&r==0) break;
    x += l*cos(angle(n));
    y += l*sin(angle(n));
    n += r; 
  }
  cout << int(y) << endl << int(x) << endl;
  return 0;
}