#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <set>
#include <vector>

#define rep2(i, b, n) for(int i=b; i < n; ++i)
#define repm(i, b, n) for(int i=b; i > n; --i)
#define rep(i, n) rep2(i, 0, n)
#define PI 3.1415926535897932384626433
#define ToRadian(r) ((r)/180.0*PI)
#define ToDegree(r) ((r)*180.0/PI)

using namespace std;

int main( void )
{
	int dist, deg;
	double ax, ay, rad;
	
	ax = ay = 0;
	rad = ToRadian(90);
	
	while (scanf("%d,%d", &dist, &deg), dist | deg)
	{
		ax += dist * cos(rad);
		ay += dist * sin(rad);
		rad += ToRadian(-deg);
	}
	
	printf("%d\n" \
		   "%d\n", (int)ax, (int)ay
	);
	
	return 0;
}