#include <iostream>
#include <cmath>

void sepTwoNumbers(char*, int&, int&);
int char2Number(const char*, int, int);

bool inputNumber(char*);

int main(){
	double const PI = 3.141592653589793;
	double point[2] = { 0, 0 };
	int angle = 90;
	int d, a;
	char inputNumbers[10];
	while (inputNumber(inputNumbers)){
		sepTwoNumbers(inputNumbers, d, a);
		
		point[0] += d * std::cos(PI * angle / 180);
		point[1] += d * std::sin(PI * angle / 180);
		angle -= a;
	}
	std::cout << static_cast<int>(point[0]) << std::endl;
	std::cout << static_cast<int>(point[1]) << std::endl;
	return 0;
}

//入力文字から2つの文字を分離させる関数
void sepTwoNumbers(char* charOftwoNumber, int& number1, int& number2){
	int commaIndex;
	int endIndex;

	for (commaIndex = 0; charOftwoNumber[commaIndex] != ','; ++commaIndex);

	number1 = char2Number(charOftwoNumber, 0, commaIndex);

	for (endIndex = commaIndex; charOftwoNumber[endIndex] != '\0'; ++endIndex);

	number2 = char2Number(charOftwoNumber, commaIndex + 1, endIndex);
}

//文字列を数字に変換する関数
int char2Number(const char* charNumber, int startDigit, int endDigit){
	int number = 0;
	int sd = 1;
	if (charNumber[startDigit] == '-'){
		sd = -1;
		++startDigit;
	}
	for (int i = startDigit; i < endDigit; ++i){
		number *= 10;
		number += charNumber[i] - '0';
	}
	return number * sd;
}

bool inputNumber(char* inputNumbers){
	std::cin >> inputNumbers;
	if (inputNumbers[0] == '0' && inputNumbers[2] == '0'){
		return false;
	}
	else{
		return true;
	}
}
