#include<iostream>
#include<cmath>

int main(void)
{
	/*

	const double pi = std::acos(-1.0);

	double r, t;

	for(;;)
	{
		std::cin >> r >> t;

		if(r==0 && t==0)
		{
			break;
		}

		double tRad = t/360.0*2.0*pi;

		std::cout << "(x,y)=" << '(' << r*cos(tRad) << ',' << r*sin(tRad) << ")\n";
	}
	*/
	const double pi = std::acos(-1.0);

	double rIn, tIn;//tInの単位は°

	char c;

	double t = 0;//tの単位はrad

	double x=0, y=0;

	for(;;)
	{
		std::cin >> rIn >> c >> tIn;

		if(rIn==0 && tIn==0)
		{
			break;
		}

		x += rIn*(std::sin(t));

		y += rIn*(std::cos(t));

		t += tIn/360.0*2.0*pi;//°→radの変換した後tに足す

	}

	int xI =x, yI=y;

	std::cout << xI << '\n' << yI << '\n';
	
}