import sys

import math  # noqa

import bisect  # noqa

import queue  # noqa





def input():

    return sys.stdin.readline().rstrip()





if __name__ == '__main__':

    N = int(eval(input()))

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

    S = [0 for _ in range(N - 1)]

    F = [0 for _ in range(N - 1)]

    for i in range(N - 1):

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

        C[i] = c

        S[i] = s

        F[i] = f



    for i in range(N - 1):

        t = S[i]

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

            t += C[j]

            if j < N - 2:

                next_t = S[j + 1]

                while t > next_t:

                    next_t += F[j + 1]

                t = next_t

        print(t)

    print((0))

import sys

import math  # noqa

import bisect  # noqa

import queue  # noqa





def input():

    return sys.stdin.readline().rstrip()





if __name__ == '__main__':

    N = int(eval(input()))

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

    S = [0 for _ in range(N - 1)]

    F = [0 for _ in range(N - 1)]

    for i in range(N - 1):

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

        C[i] = c

        S[i] = s

        F[i] = f



    for i in range(N - 1):

        t = S[i]

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

            t += C[j]

            if j < N - 2:

                next_t = S[j + 1]

                if t > next_t:

                    next_t += math.ceil((t - next_t) / F[j + 1]) * F[j + 1]

                t = next_t

        print(t)

    print((0))

import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


if __name__ == "__main__":
    N = int(eval(input()))
    C = [0 for _ in range(N - 1)]
    S = [0 for _ in range(N - 1)]
    F = [0 for _ in range(N - 1)]
    for i in range(N - 1):
        c, s, f = list(map(int, input().split()))
        C[i] = c
        S[i] = s
        F[i] = f
    for i in range(N - 1):
        t = S[i]
        for j in range(i, N - 1):
            t += C[j]
            if j < N - 2:
                next_t = S[j + 1]
                while t > next_t:
                    next_t += F[j + 1]
                t = next_t
        print(t)
    print((0))

import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


if __name__ == "__main__":
    N = int(eval(input()))
    C = [0 for _ in range(N - 1)]
    S = [0 for _ in range(N - 1)]
    F = [0 for _ in range(N - 1)]
    for i in range(N - 1):
        c, s, f = list(map(int, input().split()))
        C[i] = c
        S[i] = s
        F[i] = f
    for i in range(N - 1):
        t = S[i]
        for j in range(i, N - 1):
            t += C[j]
            if j < N - 2:
                next_t = S[j + 1]
                if t > next_t:
                    next_t += math.ceil((t - next_t) / F[j + 1]) * F[j + 1]
                t = next_t
        print(t)
    print((0))

-                while t > next_t: -                    next_t += F[j + 1] +                if t > next_t: +                    next_t += math.ceil((t - next_t) / F[j + 1]) * F[j + 1]