import java.lang.Math

fun main(args: Array<String>) {
    val inputN = readLine().orEmpty().toInt()
    val diagramC = mutableListOf<Int>()
    val diagramS = mutableListOf<Int>()
    val diagramF = mutableListOf<Int>()

    val ansList = mutableListOf<Int>()

    for(i in 0 until inputN - 1){
        val dia = readLine()?.split(" ").orEmpty()

        diagramC.add(dia[0].toInt())
        diagramS.add(dia[1].toInt())
        diagramF.add(dia[2].toInt())
    }
    ansList.add(0)
    var j = inputN - 2
    while(j >= 0){
        var time = diagramC[j] + diagramS[j]
        for(k in j + 1 until inputN - 1) {
            run loop@{
             for (l in Math.max(time, diagramS[k]) until Math.max(time, diagramS[k]) + diagramF[k]) {
                    if ((l - diagramS[k]) % diagramF[k] == 0) {
                       time = l + diagramC[k]
                        return@loop
                    }
             }
            }
        }
        ansList.add(time)
        j -= 1
    }


    val showList = ansList.reversed()
    showList.forEach{
        println(it)
    }

}