import scala.io.StdIn.readLine

object Main extends App {
  var l = readLine.split(",").map(_.toDouble);
  var e = 0D;var n = 0D;var angle = 90D

  while(l(0)!=0 || l(0)!=0) {
    e += l(0)*Math.cos(Math.toRadians(angle))
    n += l(0)*Math.sin(Math.toRadians(angle))
    angle = angle - l(1)
    l = readLine.split(",").map(_.toDouble);
  }

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