#include<iostream>
#include<complex>
#include<cstdio>
using namespace std;

int main(){
  int r,rad,nrad;
  double x,y;
  x = y =  nrad = 0;
  while(true){
    scanf("%d,%d",&r,&rad);
    if(r+rad == 0)break;
    x += r*sin(nrad*(M_PI/180));
    y += r*cos(nrad*(M_PI/180));
    nrad += rad;
  }
  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}