import scala.io.StdIn.readLine

object Main extends App {
  var l = readLine.split(",").map(_.toDouble);
  var x=l(0);var y=l(1);var e = 0D;var n = 0D;var angle = 90D
  while(x!=0 || y!=0) {
    e += x*Math.cos(Math.toRadians(angle))
    n += x*Math.sin(Math.toRadians(angle))
    angle = angle - y
    l = readLine.split(",").map(_.toDouble);
    x = l(0);y = l(1)
  }

  println(e.toInt)
  println(n.toInt)
}