import Foundation

func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").map(f)
}

func main() {
    let n = Int(readLine()!)!
    let stations = (1..<n).map { _ in readWords { Int($0)! } }

    for i in 0..<n {
        var time = 0
        for j in i..<n-1 {
            if time < stations[j][1] {
                time = stations[j][1]
            } else if time % stations[j][2] != 0 {
                time = time + stations[j][2] - time % stations[j][2]
            }
            time += stations[j][0] 
        }
        print(time)
    }

}


main()