import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt - 1
  val s = Iterator.continually(in.readLine)
    .take(n)
    .map(_.split(" ").map(_.toInt))
    .toArray

  def f(i:Int):Int = {
    def rec(t:Int, i:Int):Int = {
      if(i == n) t
      else {
        val start = s(i)(1)
        val cost = s(i)(0)
        if(t < start) rec(start+cost, i+1)
        else {
          val cost = (t % s(i)(2)) + s(i)(0)
          rec(t+cost, i+1)
        }
      }
    }
    rec(0,i)
  }

  val out = new java.io.PrintWriter(System.out)
  (0 to n).foreach(i => out.println(f(i)))
  out.flush
}