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)
    // }
    val time = st.drop(i)
      .foldLeft(0,i)((acc,e) => {
        val s = st(acc._2)(1)
        val f = st(acc._2)(2)

        val t = if(acc._1 < s) s
          else if (acc._1 % f == 0) acc._1
          else acc._1 + f - acc._1 % f

        (t + st(acc._2)(0), acc._2 + 1)
      })
    out.println(time._1)
  }

  out.flush
}