import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

case class Station(c: Int, s: Int, f: Int)

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt
    val stations = Array.fill(n - 1) {
      in.readLine().split("\\s+").map(_.toInt) match {
        case Array(c, s, f) => Station(c, s, f)
      }
    }

    for(i <- 0 until n) {
      var t = 0
      for(j <- i until (n - 1)) {
        val station = stations(j)
        val d = if (station.s >= t) {
          station.s
        } else {
          station.s + station.f * Math.ceil(1.0 * (t - station.s) / station.f).toInt
        }
        t = d + station.c
      }
      out.println(t)
    }

    out.flush()
  }
}
