import Math._
import scala.util.control.Breaks
object Main extends App {
  val bk = Breaks

  var x = 0.0
  var y = 0.0
  var a = toRadians(90.0)

  bk.breakable {
    while (true) {
      val Seq(td, ta) = readLine().split(',').map(_.toInt).toList
      if (td == 0 && ta == 0) bk.break()

      x += td * cos(a)
      y += td * sin(a)
      a -= toRadians(ta)
    }
  }

  println(x.toString.split('.')(0))
  println(y.toString.split('.')(0))
}
