import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val cs = LongArray(n - 1)
    val ss = LongArray(n - 1)
    val fs = LongArray(n - 1)
    repeat(n - 1) {
        val (c, s, f) = readLongList()
        cs[it] = c
        ss[it] = s
        fs[it] = f
    }

    for (i in 0 until (n - 1)) {
        var x = ss[i] + cs[i]
        for (j in (i + 1) until (n - 1)) {
            x = if (x <= ss[j]) {
                ss[j] + cs[j]
            } else {
                val w = (x - ss[j] + fs[j] - 1) / fs[j]
                ss[j] + fs[j] * w + cs[j]
            }
        }
        out.println(x)
    }
    out.println(0)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)
