import scala.io.StdIn

object Main extends App {
  val out = new java.io.PrintWriter(System.out)

  val n = StdIn.readLine.toInt
  val st = Iterator.continually(StdIn.readLine)
          .take(n-1)
          .map(_.split(" ").map(_.toInt))
          .toArray

  for(i <- 0 until n) {
    var t = 0
    for(j <- i until n-1) {
      t = if(t < st(j)(1)) st(j)(1)
        else if (t%st(j)(2) == 0) t
        else t + st(j)(2) - t % st(j)(2)
      t += st(j)(0)
    }
    out.println(t)
  }

  out.flush
}
