void main()
{
    int n = readln.chomp.to!int;

    int[] c = new int[n-1], s = new int[n-1], f = new int[n-1];
    foreach (i; 0 .. n-1)
    {
        int[] tmp = readln.split.to!(int[]);
        c[i] = tmp[0], s[i] = tmp[1], f[i] = tmp[2];
    }

    int[] time = new int[n];
    foreach (i; 0 .. n-1)
    {
        foreach (j; i .. n-1)
        {
            if (time[i] < s[j])
            {
                time[i] = s[j];
            }
            else
            {
                int m = (time[i] - s[j] + f[j] - 1) / f[j];
                time[i] = s[j] + f[j] * m;
            }

            time[i] += c[j];
        }
    }

    foreach (x; time)
    {
        x.writeln;
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;