#include<cstdio>
#include<cmath>
#include<iostream>
#define PI 3.14159265358979
double rad(double a){
  return a*PI/180.0;
}

int main(){
  int a,b;
  int th=0;
  double x = 0, y = 0;
  while(scanf("%d,%d",&a,&b)){
    if(a==0&&b==0)break;
    x+=(double)a*sin(rad(th));
    y+=(double)a*cos(rad(th));
    th+=b;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  return 0;
}