# ABC084C - Special Trains

import sys

input = sys.stdin.readline



def main():

    n = int(eval(input()))

    arr = tuple(tuple(map(int, input().split())) for _ in range(n - 1))

    for i in range(n):

        cur = 0

        for c, s, f in arr[i:]:

            if cur <= s:

                cur = s + c

            elif cur % f == 0:

                cur += c

            else:

                cur += f - cur % f + c

        print(cur)





if __name__ == "__main__":

    main()
# ABC084C - Special Trains

import sys

input = sys.stdin.readline



def main():

    N = int(eval(input()))

    A = tuple(tuple(map(int, input().split())) for _ in range(N - 1))

    for i in range(N):

        cur = 0

        for c, s, f in A[i:]:

            if cur <= s:

                cur = s + c

            else:

                cur = (cur + f - 1) // f * f + c  # ? (@maspy)

        print(cur)





if __name__ == "__main__":

    main()
# ABC084C - Special Trains
import sys

input = sys.stdin.readline


def main():
    n = int(eval(input()))
    arr = tuple(tuple(map(int, input().split())) for _ in range(n - 1))
    for i in range(n):
        cur = 0
        for c, s, f in arr[i:]:
            if cur <= s:
                cur = s + c
            elif cur % f == 0:
                cur += c
            else:
                cur += f - cur % f + c
        print(cur)


if __name__ == "__main__":
    main()

# ABC084C - Special Trains
import sys

input = sys.stdin.readline


def main():
    N = int(eval(input()))
    A = tuple(tuple(map(int, input().split())) for _ in range(N - 1))
    for i in range(N):
        cur = 0
        for c, s, f in A[i:]:
            if cur <= s:
                cur = s + c
            else:
                cur = (cur + f - 1) // f * f + c  # ? (@maspy)
        print(cur)


if __name__ == "__main__":
    main()

-    n = int(eval(input())) -    arr = tuple(tuple(map(int, input().split())) for _ in range(n - 1)) -    for i in range(n): +    N = int(eval(input())) +    A = tuple(tuple(map(int, input().split())) for _ in range(N - 1)) +    for i in range(N): -        for c, s, f in arr[i:]: +        for c, s, f in A[i:]: -            elif cur % f == 0: -                cur += c -                cur += f - cur % f + c +                cur = (cur + f - 1) // f * f + c  # ? (@maspy)