#include<iostream>
#include<stdio.h>
#include<math.h>

int main()
{
	double x = 0, y = 0;
	double pace, angle;
	double theta = 0;
	
	while( 1 ){
		scanf( "%lf,%lf", &pace, &angle );
		if( !pace && !angle ) break;
		
		x += cos( ( 90 - theta ) * 3.1415926535 / 180 ) * pace;
		y += sin( ( 90 - theta ) * 3.1415926535 / 180 ) * pace;
		theta += angle;
	}
	
	printf( "%d\n%d\n", (int)x, (int)y );
	                      
 	return 0;
}