local n=io.read("n")
local c,s,f={},{},{}
for i=1,n-1 do
    c[i],s[i],f[i]=io.read("n","n","n")
end

for i=1,n do
    local t=0
    for j=i,n-1 do
        if t<s[j] then
            t=s[j]
        elseif t%f[j]>0 then
            t=t+f[j]-t%f[j]
        end
        t=t+c[j]
    end
    print(t)
end