#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main() {
 int a,b,r=90;
 double x=0,y=0;
 char c;
 while(true) {
 scanf("%d%c%d",&a,&c,&b);
 if (a==0 && b==0) break;
 x+=a*cos(3.141592*r/180);
 y+=a*sin(3.141592*r/180);
 r-=b;
 }
 cout << (int)x << endl << (int)y << endl;
 return 0;
}