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