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

void main()
{
  double theta = 0;
  double x = 0, y = 0;
  foreach (s; stdin.byLine) {
    auto num = s.split(",").map!(to!int)();
    if (!num[0] && !num[1]) break;
    x += sin(theta * (PI / 180)) * num[0];
    y += cos(theta * (PI / 180)) * num[0];
    theta += num[1];
  }
  x.trunc.writeln();
  y.trunc.writeln();
}