import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;
import std.math;

void main()
{
    real x=0, y=0;
    int deg=90;
    foreach(s;stdin.byLine())
    {
        auto m = s.chomp().split(",").map!(to!int);
        immutable n=m[0], d=m[1];
        if(n==0 && d==0) break;
        x+=n*cos(PI*deg/180);
        y+=n*sin(PI*deg/180);
        deg=(deg-d)%360;
    }
    writeln(cast(int)(x),",",cast(int)(y));
}