N=int(input())
C=[]
S=[]
F=[]
from math import ceil
for _ in range(N-1):
    c,s,f=map(int,input().split())
    C.append(c)
    S.append(s)
    F.append(f)
ans=[]
for i in range(0,N-1):
    t=S[i]+C[i]
    sta=i+1
    while sta<N-1:
        if t<=S[sta]:
            t=S[sta]+C[sta]
        else:
            k=ceil((t-S[sta])/F[sta])
            t=S[sta]+k*F[sta]+C[sta]
        sta+=1
    ans.append(t)
for a in ans:
    print(a)
print(0)
