/*AOJ 0016*/

#include<iostream>

#define M_PI 3.14159265

using namespace std;

double changeDegToRad(double deg){

	return deg*M_PI/180.0;

}

int main(){

	double x = 0,y = 0;
	double deg = 0,walk = 0;
	double rad = M_PI/2.0;
	while(1){
		scanf("%lf,%lf",&walk,&deg);


		if(deg==0&&walk==0){
			break;
		}

		x += walk * cos(rad);
		y += walk * sin(rad);

		rad -= changeDegToRad(deg);

	}

	cout<<(int)x<<" "<<(int)y<<endl;
	return 0;
}