fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val cs = mutableListOf<Int>()
    val ss = mutableListOf<Int>()
    val fs = mutableListOf<Int>()

    for (i in 0..(n-2)) {
        val (c, s, f) = readLine()!!.split(" ").map { it.toInt() }
        cs.add(c)
        ss.add(s)
        fs.add(f)
    }
    for (i in 0..(n-2)) {
        var ans = 0
        for (j in i..(n-2)) {
            var next = ss.get(j)
            while (ans > next) {
                next += fs.get(j)
            }
            ans = next
            ans += cs.get(j)
        }
        println(ans)
    }
    println(0)
}