#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

typedef pair<int, int> paii;
typedef long long ll;

int main()
{
	complex<double> z = complex<double>(0, 0);
	double r, tht = 0, dtht;
	char c;
	
	while(cin >> r >> c >> dtht, (r||dtht))
	{
		z += polar(r, tht*acos(-1.0)/180.0);
		tht += dtht;
	}
	
	cout << (int)z.imag() << endl;
	cout << (int)z.real() << endl;
	
	return 0;
}