local mce, mma = math.ceil, math.max
local ior = io.input()
local n = ior:read("*n")
local c, s, f = {}, {}, {}
for i = 1, n - 1 do
  c[i], s[i], f[i] = ior:read("*n", "*n", "*n")
end
for i = 1, n - 1 do
  local time = 0
  for j = i, n - 1 do
    local ridetime = mma(s[j], f[j] * mce(time / f[j]))
    time = ridetime + c[j]
  end
  print(time)
end
print(0)
