import sys



readline = sys.stdin.readline

N = int(readline())

CSF = []

for i in range(N-1):

    CSF.append(tuple(map(int, readline().split())))

for i in range(N):

    time = 0

    for c, s, f in CSF[i:N-1]:

        if time < s:

            time = s

        else:

            time = (time+f-1)//f*f

        time += c

    print(time)

import sys



readline = sys.stdin.readline

N = int(readline())

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

for i in range(N):

    time = 0

    for c, s, f in CSF[i:N-1]:

        if time < s:

            time = s

        else:

            time = (time+f-1)//f*f

        time += c

    print(time)

import sys

readline = sys.stdin.readline
N = int(readline())
CSF = []
for i in range(N - 1):
    CSF.append(tuple(map(int, readline().split())))
for i in range(N):
    time = 0
    for c, s, f in CSF[i : N - 1]:
        if time < s:
            time = s
        else:
            time = (time + f - 1) // f * f
        time += c
    print(time)

import sys

readline = sys.stdin.readline
N = int(readline())
CSF = [tuple(map(int, readline().split())) for _ in range(N - 1)]
for i in range(N):
    time = 0
    for c, s, f in CSF[i : N - 1]:
        if time < s:
            time = s
        else:
            time = (time + f - 1) // f * f
        time += c
    print(time)

-CSF = [] -for i in range(N - 1): -    CSF.append(tuple(map(int, readline().split()))) +CSF = [tuple(map(int, readline().split())) for _ in range(N - 1)]