fun readInts() = readLine()!!.split(' ').map(String::toInt)

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val t = IntArray(n)
    repeat(n - 1) {
        val (c, s, f) = readInts()
        for (i in 0 until it) {
            if (t[i] < s) {
                t[i] = s + c
                continue
            }
            val w = t[i] % f
            t[i] += if (w == 0) c else c + f - w
        }
        t[it] = s + c
    }
    t.forEach(::println)
}
