def examC():

    N = I()

    C = [0]*N; S =[0]*N; F = [0]*N

    for i in range(N-1):

        C[i], S[i], F[i] = LI()

    ans = []

    for i in range(N):

        cur = 0

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

            cur = max(((cur-1)//F[j] +1)*F[j],S[j])+C[j]

        ans.append(cur)

    for v in ans:

        print(v)



import sys,copy,bisect,itertools,heapq,math

from heapq import heappop,heappush,heapify

from collections import Counter,defaultdict,deque

def I(): return int(sys.stdin.readline())

def LI(): return list(map(int,sys.stdin.readline().split()))

def LS(): return sys.stdin.readline().split()

def S(): return sys.stdin.readline().strip()

mod = 10**9 + 7

inf = float('inf')



examC()

def examA():

    C1 = SI()

    C2 = SI()

    ans = "YES"

    if C1[0]!=C2[2] or C1[1]!=C2[1] or C1[2]!=C2[0]:

        ans = "NO"

    print(ans)

    return



def examB():

    A, B, C, X, Y = LI()

    loop = max(X,Y)

    ans = inf

    for i in range(loop+1):

        cost = i*2*C

        if X>i:

            cost += A*(X-i)

        if Y>i:

            cost += B*(Y-i)

        ans = min(ans,cost)

    print(ans)

    return



def examC():

    def gcd(x, y):

        if y == 0:

            return x

        while (y != 0):

            x, y = y, x % y

        return x

    N, x = LI()

    X = LI()

    if N==1:

        print((abs(X[0]-x)))

        return

    for i in range(N):

        X[i] = abs(X[i]-x)

    now = gcd(X[0],X[1])

    for i in range(2,N):

        now = gcd(now,X[i])

    ans = now

    print(ans)

    return



def examD():

    N = I()

    C = [LI()for _ in range(N-1)]

    ans = [inf]*N

    for i in range(N):

        cur = 0

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

            c, s, f = C[j]

            next = 0

            if cur<=s:

                cur = s+c

            else:

                cur = (1+(cur-1)//f)*f + c

        ans[i] = cur

    for v in ans:

        print(v)

    return



def examE():

    ans = 0

    print(ans)

    return



def examF():

    ans = 0

    print(ans)

    return



from decimal import Decimal as dec

import sys,bisect,itertools,heapq,math,random

from copy import deepcopy

from heapq import heappop,heappush,heapify

from collections import Counter,defaultdict,deque

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

def I(): return int(eval(input()))

def LI(): return list(map(int,sys.stdin.readline().split()))

def DI(): return dec(eval(input()))

def LDI(): return list(map(dec,sys.stdin.readline().split()))

def LSI(): return list(map(str,sys.stdin.readline().split()))

def LS(): return sys.stdin.readline().split()

def SI(): return sys.stdin.readline().strip()

global mod,mod2,inf,alphabet,_ep

mod = 10**9 + 7

mod2 = 998244353

inf = 10**18

_ep = 10**(-12)

alphabet = [chr(ord('a') + i) for i in range(26)]



sys.setrecursionlimit(10**7)



if __name__ == '__main__':

    examD()



"""

142

12 9 1445 0 1

asd dfg hj o o

aidn

"""
def examC():
    N = I()
    C = [0] * N
    S = [0] * N
    F = [0] * N
    for i in range(N - 1):
        C[i], S[i], F[i] = LI()
    ans = []
    for i in range(N):
        cur = 0
        for j in range(i, N - 1):
            cur = max(((cur - 1) // F[j] + 1) * F[j], S[j]) + C[j]
        ans.append(cur)
    for v in ans:
        print(v)


import sys, copy, bisect, itertools, heapq, math
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque


def I():
    return int(sys.stdin.readline())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def LS():
    return sys.stdin.readline().split()


def S():
    return sys.stdin.readline().strip()


mod = 10**9 + 7
inf = float("inf")
examC()

def examA():
    C1 = SI()
    C2 = SI()
    ans = "YES"
    if C1[0] != C2[2] or C1[1] != C2[1] or C1[2] != C2[0]:
        ans = "NO"
    print(ans)
    return


def examB():
    A, B, C, X, Y = LI()
    loop = max(X, Y)
    ans = inf
    for i in range(loop + 1):
        cost = i * 2 * C
        if X > i:
            cost += A * (X - i)
        if Y > i:
            cost += B * (Y - i)
        ans = min(ans, cost)
    print(ans)
    return


def examC():
    def gcd(x, y):
        if y == 0:
            return x
        while y != 0:
            x, y = y, x % y
        return x

    N, x = LI()
    X = LI()
    if N == 1:
        print((abs(X[0] - x)))
        return
    for i in range(N):
        X[i] = abs(X[i] - x)
    now = gcd(X[0], X[1])
    for i in range(2, N):
        now = gcd(now, X[i])
    ans = now
    print(ans)
    return


def examD():
    N = I()
    C = [LI() for _ in range(N - 1)]
    ans = [inf] * N
    for i in range(N):
        cur = 0
        for j in range(i, N - 1):
            c, s, f = C[j]
            next = 0
            if cur <= s:
                cur = s + c
            else:
                cur = (1 + (cur - 1) // f) * f + c
        ans[i] = cur
    for v in ans:
        print(v)
    return


def examE():
    ans = 0
    print(ans)
    return


def examF():
    ans = 0
    print(ans)
    return


from decimal import Decimal as dec
import sys, bisect, itertools, heapq, math, random
from copy import deepcopy
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def I():
    return int(eval(input()))


def LI():
    return list(map(int, sys.stdin.readline().split()))


def DI():
    return dec(eval(input()))


def LDI():
    return list(map(dec, sys.stdin.readline().split()))


def LSI():
    return list(map(str, sys.stdin.readline().split()))


def LS():
    return sys.stdin.readline().split()


def SI():
    return sys.stdin.readline().strip()


global mod, mod2, inf, alphabet, _ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10 ** (-12)
alphabet = [chr(ord("a") + i) for i in range(26)]
sys.setrecursionlimit(10**7)
if __name__ == "__main__":
    examD()
"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

+def examA(): +    C1 = SI() +    C2 = SI() +    ans = "YES" +    if C1[0] != C2[2] or C1[1] != C2[1] or C1[2] != C2[0]: +        ans = "NO" +    print(ans) +    return + + +def examB(): +    A, B, C, X, Y = LI() +    loop = max(X, Y) +    ans = inf +    for i in range(loop + 1): +        cost = i * 2 * C +        if X > i: +            cost += A * (X - i) +        if Y > i: +            cost += B * (Y - i) +        ans = min(ans, cost) +    print(ans) +    return + + +    def gcd(x, y): +        if y == 0: +            return x +        while y != 0: +            x, y = y, x % y +        return x + +    N, x = LI() +    X = LI() +    if N == 1: +        print((abs(X[0] - x))) +        return +    for i in range(N): +        X[i] = abs(X[i] - x) +    now = gcd(X[0], X[1]) +    for i in range(2, N): +        now = gcd(now, X[i]) +    ans = now +    print(ans) +    return + + +def examD(): -    C = [0] * N -    S = [0] * N -    F = [0] * N -    for i in range(N - 1): -        C[i], S[i], F[i] = LI() -    ans = [] +    C = [LI() for _ in range(N - 1)] +    ans = [inf] * N -            cur = max(((cur - 1) // F[j] + 1) * F[j], S[j]) + C[j] -        ans.append(cur) +            c, s, f = C[j] +            next = 0 +            if cur <= s: +                cur = s + c +            else: +                cur = (1 + (cur - 1) // f) * f + c +        ans[i] = cur +    return -import sys, copy, bisect, itertools, heapq, math +def examE(): +    ans = 0 +    print(ans) +    return + + +def examF(): +    ans = 0 +    print(ans) +    return + + +from decimal import Decimal as dec +import sys, bisect, itertools, heapq, math, random +from copy import deepcopy +read = sys.stdin.buffer.read +readline = sys.stdin.buffer.readline +readlines = sys.stdin.buffer.readlines + -    return int(sys.stdin.readline()) +    return int(eval(input())) +def DI(): +    return dec(eval(input())) + + +def LDI(): +    return list(map(dec, sys.stdin.readline().split())) + + +def LSI(): +    return list(map(str, sys.stdin.readline().split())) + + -def S(): +def SI(): +global mod, mod2, inf, alphabet, _ep -inf = float("inf") -examC() +mod2 = 998244353 +inf = 10**18 +_ep = 10 ** (-12) +alphabet = [chr(ord("a") + i) for i in range(26)] +sys.setrecursionlimit(10**7) +if __name__ == "__main__": +    examD() +""" +142 +12 9 1445 0 1 +asd dfg hj o o +aidn +"""