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

int main(){
    double x=0,y=0;
    int degree = 90;
    double t;
    int d;
    char c;
    double pi = 3.141592;
    while(true){
       cin >> t;
       x += t*cos(degree*pi/180);
       y += t*sin(degree*pi/180);
      	cin >> c;
       cin >> d;

       degree += d;
       if(t==0&&d==0)
		break;
       
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    x = 0,y = 0;
    
    return 0;
}