let N = Int(readLine()!)!
var C = [Int]()
var S = [Int]()
var F = [Int]()
for i in 1..<N {
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    C += [input[0]]
    S += [input[1]]
    F += [input[2]]
}
for i in 0..<N {
    var t = 0
    for j in i..<N-1 {
        t = max(S[j],t)+(F[j]-t%F[j])%F[j]+C[j]
    }
    print(t)
}