import java.io.*
import java.util.*

var pw = PrintWriter(System.out)
fun solve(N: Int, C: IntArray, S: IntArray, F: IntArray) {
    for (i in 0 until N - 1) {
    var time = S[i] + C[i]
        for (j in i + 1 until N - 1) {
            time = when {
                time <= S[j] -> S[j]
                else -> S[j] + floorDiv(time - S[j], F[j]) * F[j]
            }
            time += C[j]
        }
        pw.println(time)
    }
    pw.println(0)
    pw.flush()
    return
}

fun floorDiv(a: Int, b: Int): Int = a / b + if (a % b == 0) 0 else 1

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val C = IntArray(N - 1)
    val S = IntArray(N - 1)
    val F = IntArray(N - 1)
    for (i in 0 until N - 1) {
        C[i] = sc.next().toInt()
        S[i] = sc.next().toInt()
        F[i] = sc.next().toInt()
    }
    solve(N, C, S, F)
}
