import std.stdio;
import std.string;
import std.math;
import std.conv;
import std.algorithm;
import std.bigint;

void main(){

    double x,y;
    double angle;
    x = 0;
    y = 0;
    angle = 90;

    while(true){
	auto d = split(chomp(readln()),",");
	if(d[0] == "0" && d[1] == "0" )break;
	auto dr = to!double(d[0]);
	auto rad = to!double(angle/360.0);
	x += dr * cos(2*PI*rad);
	y += dr * sin(2*PI*rad);
	angle -= to!double(d[1]);
    }
    x = to!int(x);
    y = to!int(y);
    writeln(x);
    writeln(y);
}