import sys

input = sys.stdin.readline



n = int(eval(input()))

csfn = [() for i in range(n-1)]

tl = [0]*n

for i in range(n-1):

  c,s,f = list(map(int,input().split()))

  csfn[i] += (c,s,f)

  

  for j in range(i+1):

    if tl[j] < csfn[i][1]:

      tl[j] = csfn[i][1] + csfn[i][0]

    elif tl[j] % csfn[i][2] == 0:

      tl[j] += csfn[i][0]

    else:

      tl[j] += csfn[i][0] + csfn[i][2] - tl[j] % csfn[i][2]

for k in tl:

  print(k)  
import sys

input = sys.stdin.readline



n = int(eval(input()))

tl = [0]*n

for i in range(n-1):

  c,s,f = list(map(int,input().split()))  

  for j in range(i+1):

    if tl[j] < s:

      tl[j] = s + c

    elif tl[j] % f == 0:

      tl[j] += c

    else:

      tl[j] += c + f - tl[j] % f

for k in tl:

  print(k)
import sys

input = sys.stdin.readline
n = int(eval(input()))
csfn = [() for i in range(n - 1)]
tl = [0] * n
for i in range(n - 1):
    c, s, f = list(map(int, input().split()))
    csfn[i] += (c, s, f)
    for j in range(i + 1):
        if tl[j] < csfn[i][1]:
            tl[j] = csfn[i][1] + csfn[i][0]
        elif tl[j] % csfn[i][2] == 0:
            tl[j] += csfn[i][0]
        else:
            tl[j] += csfn[i][0] + csfn[i][2] - tl[j] % csfn[i][2]
for k in tl:
    print(k)

import sys

input = sys.stdin.readline
n = int(eval(input()))
tl = [0] * n
for i in range(n - 1):
    c, s, f = list(map(int, input().split()))
    for j in range(i + 1):
        if tl[j] < s:
            tl[j] = s + c
        elif tl[j] % f == 0:
            tl[j] += c
        else:
            tl[j] += c + f - tl[j] % f
for k in tl:
    print(k)

-csfn = [() for i in range(n - 1)] -    csfn[i] += (c, s, f) -        if tl[j] < csfn[i][1]: -            tl[j] = csfn[i][1] + csfn[i][0] -        elif tl[j] % csfn[i][2] == 0: -            tl[j] += csfn[i][0] +        if tl[j] < s: +            tl[j] = s + c +        elif tl[j] % f == 0: +            tl[j] += c -            tl[j] += csfn[i][0] + csfn[i][2] - tl[j] % csfn[i][2] +            tl[j] += c + f - tl[j] % f