N = int(eval(input()))

lst = []

for i in range(N-1):

    lst += [list(map(int, input().split()))]



# print (lst)

for i in range(N):

    t = 0

    for j in range(i, N-1):

        # print ('j', j)

        t = (max(lst[j][1], t)+lst[j][2] -1)//lst[j][2]*lst[j][2] + lst[j][0]

        # print ('t', t)

    print (t)
import sys

input = sys.stdin.readline



N = int(eval(input()))

CSF = [tuple(map(int, input().split())) for _ in range(N - 1)]



def calc(x): #xからの客がNに到達するのにかかる時間

    tmp = 0

    for i in range(x, N - 1):

        tmp = max((tmp + CSF[i][2] - 1) // CSF[i][2] * CSF[i][2], CSF[i][1]) + CSF[i][0] 

    return tmp





for i in range(N):

    print((calc(i)))
N = int(eval(input()))
lst = []
for i in range(N - 1):
    lst += [list(map(int, input().split()))]
# print (lst)
for i in range(N):
    t = 0
    for j in range(i, N - 1):
        # print ('j', j)
        t = (max(lst[j][1], t) + lst[j][2] - 1) // lst[j][2] * lst[j][2] + lst[j][0]
        # print ('t', t)
    print(t)

import sys

input = sys.stdin.readline
N = int(eval(input()))
CSF = [tuple(map(int, input().split())) for _ in range(N - 1)]


def calc(x):  # xからの客がNに到達するのにかかる時間
    tmp = 0
    for i in range(x, N - 1):
        tmp = max((tmp + CSF[i][2] - 1) // CSF[i][2] * CSF[i][2], CSF[i][1]) + CSF[i][0]
    return tmp


for i in range(N):
    print((calc(i)))

+import sys + +input = sys.stdin.readline -lst = [] -for i in range(N - 1): -    lst += [list(map(int, input().split()))] -# print (lst) +CSF = [tuple(map(int, input().split())) for _ in range(N - 1)] + + +def calc(x):  # xからの客がNに到達するのにかかる時間 +    tmp = 0 +    for i in range(x, N - 1): +        tmp = max((tmp + CSF[i][2] - 1) // CSF[i][2] * CSF[i][2], CSF[i][1]) + CSF[i][0] +    return tmp + + -    t = 0 -    for j in range(i, N - 1): -        # print ('j', j) -        t = (max(lst[j][1], t) + lst[j][2] - 1) // lst[j][2] * lst[j][2] + lst[j][0] -        # print ('t', t) -    print(t) +    print((calc(i)))