object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val (c, s, f) = Array.fill(n-1)((sc.nextInt(), sc.nextInt(), sc.nextInt())).unzip3
  for (i <- 0 until n) {
    var ans = 0L
    var t = 0
    for (j <- i until n-1) {
      if (t <= s(j)) {
        ans += s(j) - t
        t = s(j)
      } else {
        val r = t % f(j)
        val w = if (r == 0) 0 else f(j) - r
        ans += w
        t += w
      }
      ans += c(j)
      t += c(j)
    }
    println(ans)
  }
}
