# -*- coding: utf-8 -*-

import sys

import copy

import collections

from bisect import bisect_left

from bisect import bisect_right

from collections import defaultdict

from heapq import heappop, heappush

import math



# NO, PAY-PAY

#import numpy as np

#import statistics

#from statistics import mean, median,variance,stdev

 

def main():

    N = int(eval(input()))

    csf = []

    for i in range(N-1):

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

        csf.append((c,s,f))

        

    for i, val in enumerate(csf):

        ans = 0

        c,s,f = val

        ans += s + c

        for j, vol in enumerate(csf):

            if i >= j:

                continue

                

            cc,ss,ff = vol

            if ans <= ss:

                ans = ss + cc

            else:

                tmp = ans - ss

                if tmp == 0:

                    ans += cc

                    continue

                    

                tmp2 = (tmp // ff)

                if tmp % ff != 0:

                    tmp2 += 1

                tmp2 = (tmp2 * ff) + ss

                ans = ans + (tmp2 - ans) + cc

        print(ans)

                

    print((0))

    

	

if __name__ == "__main__":

	main()

# -*- coding: utf-8 -*-

import sys

import math

from bisect import bisect_left

from bisect import bisect_right

import collections

import copy

import heapq

from collections import defaultdict

from heapq import heappop, heappush

import itertools

input = sys.stdin.readline

 

##### リストの 二分木検索 #####

# bisect_left(lists, 3)

# bisect_right(lists, 3)

 

##### プライオリティキュー #####

# heapq.heapify(a) #リストaのheap化

# heapq.heappush(a,x) #heap化されたリストaに要素xを追加

# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

 

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう

# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

 

##### タプルリストのソート #####

# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順

# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順

# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順

# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

 

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順

# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

 

##### 累乗 #####

# pow(x, y, z) -> x**y % z



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

def inputMap(): return list(map(int, input().split()))

def inputList(): return list(map(int, input().split()))

 

inf = float('inf')

mod = 1000000007

 

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():

    N = inputInt()

    csf = []

    for _ in range(N-1):

        c,s,f = inputMap()

        csf.append((c,s,f))

        

    ans = []

    for i in range(N-1):

        c,s,f = csf[i]

        tmp = s+c

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

            c,s,f = csf[j]

            #print("{} {}".format(tmp,s))

            if tmp < s:

                tmp = tmp + (s-tmp) + c

            else:

                if (tmp-s)%f == 0:

                    tmp = tmp + c

                else:

                    tmp = tmp + ((-(-(tmp-s) // f))*f + s)-tmp + c

        print(tmp)

        

    print((0))

    

     

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

# special thanks :

#  https://nagiss.hateblo.jp/entry/2019/07/01/185421

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def combination(n, r, mod=10**9+7):

    r = min(r, n-r)

    res = 1

    for i in range(r):

        res = res * (n - i) * modinv(i+1, mod) % mod

    return res

 

def modinv(a, m):

    g, x, y = egcd(a, m)

    if g != 1:

        raise Exception('modular inverse does not exist')

    else:

        return x % m

 

def egcd(a, b):

    if a == 0:

        return b, 0, 1

    else:

        g, y, x = egcd(b % a, a)

        return g, x - (b // a) * y, y

         

if __name__ == "__main__":

	main()

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
# import numpy as np
# import statistics
# from statistics import mean, median,variance,stdev
def main():
    N = int(eval(input()))
    csf = []
    for i in range(N - 1):
        c, s, f = list(map(int, input().split()))
        csf.append((c, s, f))
    for i, val in enumerate(csf):
        ans = 0
        c, s, f = val
        ans += s + c
        for j, vol in enumerate(csf):
            if i >= j:
                continue
            cc, ss, ff = vol
            if ans <= ss:
                ans = ss + cc
            else:
                tmp = ans - ss
                if tmp == 0:
                    ans += cc
                    continue
                tmp2 = tmp // ff
                if tmp % ff != 0:
                    tmp2 += 1
                tmp2 = (tmp2 * ff) + ss
                ans = ans + (tmp2 - ans) + cc
        print(ans)
    print((0))


if __name__ == "__main__":
    main()

# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools

input = sys.stdin.readline
##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)
##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力
# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと
##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順
# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順
##### 累乗 #####
# pow(x, y, z) -> x**y % z
def inputInt():
    return int(eval(input()))


def inputMap():
    return list(map(int, input().split()))


def inputList():
    return list(map(int, input().split()))


inf = float("inf")
mod = 1000000007
# -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
def main():
    N = inputInt()
    csf = []
    for _ in range(N - 1):
        c, s, f = inputMap()
        csf.append((c, s, f))
    ans = []
    for i in range(N - 1):
        c, s, f = csf[i]
        tmp = s + c
        for j in range(i + 1, N - 1):
            c, s, f = csf[j]
            # print("{} {}".format(tmp,s))
            if tmp < s:
                tmp = tmp + (s - tmp) + c
            else:
                if (tmp - s) % f == 0:
                    tmp = tmp + c
                else:
                    tmp = tmp + ((-(-(tmp - s) // f)) * f + s) - tmp + c
        print(tmp)
    print((0))


# -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# special thanks :
#  https://nagiss.hateblo.jp/entry/2019/07/01/185421
# -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
def combination(n, r, mod=10**9 + 7):
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i + 1, mod) % mod
    return res


def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception("modular inverse does not exist")
    else:
        return x % m


def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y


if __name__ == "__main__":
    main()

-import copy -import collections +import math +import collections +import copy +import heapq -import math +import itertools -# NO, PAY-PAY -# import numpy as np -# import statistics -# from statistics import mean, median,variance,stdev +input = sys.stdin.readline +##### リストの 二分木検索 ##### +# bisect_left(lists, 3) +# bisect_right(lists, 3) +##### プライオリティキュー ##### +# heapq.heapify(a) #リストaのheap化 +# heapq.heappush(a,x) #heap化されたリストaに要素xを追加 +# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力 +# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう +# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと +##### タプルリストのソート ##### +# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順 +# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順 +# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順 +# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順 +# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順 +# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順 +##### 累乗 ##### +# pow(x, y, z) -> x**y % z +def inputInt(): +    return int(eval(input())) + + +def inputMap(): +    return list(map(int, input().split())) + + +def inputList(): +    return list(map(int, input().split())) + + +inf = float("inf") +mod = 1000000007 +# -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- -    N = int(eval(input())) +    N = inputInt() +    for _ in range(N - 1): +        c, s, f = inputMap() +        csf.append((c, s, f)) +    ans = [] -        c, s, f = list(map(int, input().split())) -        csf.append((c, s, f)) -    for i, val in enumerate(csf): -        ans = 0 -        c, s, f = val -        ans += s + c -        for j, vol in enumerate(csf): -            if i >= j: -                continue -            cc, ss, ff = vol -            if ans <= ss: -                ans = ss + cc +        c, s, f = csf[i] +        tmp = s + c +        for j in range(i + 1, N - 1): +            c, s, f = csf[j] +            # print("{} {}".format(tmp,s)) +            if tmp < s: +                tmp = tmp + (s - tmp) + c -                tmp = ans - ss -                if tmp == 0: -                    ans += cc -                    continue -                tmp2 = tmp // ff -                if tmp % ff != 0: -                    tmp2 += 1 -                tmp2 = (tmp2 * ff) + ss -                ans = ans + (tmp2 - ans) + cc -        print(ans) +                if (tmp - s) % f == 0: +                    tmp = tmp + c +                else: +                    tmp = tmp + ((-(-(tmp - s) // f)) * f + s) - tmp + c +        print(tmp) + + +# -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- +# special thanks : +#  https://nagiss.hateblo.jp/entry/2019/07/01/185421 +# -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- +def combination(n, r, mod=10**9 + 7): +    r = min(r, n - r) +    res = 1 +    for i in range(r): +        res = res * (n - i) * modinv(i + 1, mod) % mod +    return res + + +def modinv(a, m): +    g, x, y = egcd(a, m) +    if g != 1: +        raise Exception("modular inverse does not exist") +    else: +        return x % m + + +def egcd(a, b): +    if a == 0: +        return b, 0, 1 +    else: +        g, y, x = egcd(b % a, a) +        return g, x - (b // a) * y, y