import math
n = int(input())
c = []
s = []
f = []
for i in range(n-1):
  x,y,z = map(int, input().split())
  c += [x]
  s += [y]
  f += [z]
  
for i in range(n-1):
  ans = s[i]+c[i]
  for j in range(i+1, n-1):
    ans = (ans//f[j]) * math.ceil(ans/f[j]) + c[j]
  print(ans)
print(0)