fun main(args: Array<String>) {
    abc084c()
}

private data class Station(val takeTime: Int, val first: Int, val interval: Int)

fun abc084c() {
    val n = readLine()!!.toInt()
    val stations = (1 until n).map { readLine()!!.split(" ").map { it.toInt() } }
        .map { Station(it[0], it[1], it[2]) }

    val times = mutableListOf<Long>()
    for (i in 0 until n) {
        var time = 0L
        (i until n - 1).forEach {
            val nextStation = stations[it]
            when {
                time < nextStation.first -> time = nextStation.first.toLong()
                time % nextStation.interval == 0L -> Unit
                else -> time = time + nextStation.interval - time % nextStation.interval
            }
            time += nextStation.takeTime
        }
        times.add(time)
    }

    println(times.joinToString(separator = System.lineSeparator()))
}
