import std.functional,
       std.algorithm,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

void main() {
  int N = readln.chomp.to!int;
  int[][] CSF = (N-1).iota.map!(_ => readln.chomp.split.to!(int[])).array;
  int[] C, S, F;

  foreach (csf; CSF) {
    C ~= csf[0];
    S ~= csf[1];
    F ~= csf[2];
  }

  foreach (i; 0..N) {
    int x;
    for (ulong j = i; j < N - 1; j++) {
      if (x < S[j]) {
        x = S[j];
      }

      if (x % F[j] != 0) {
        x = x+F[j] - x%F[j];
      }

      x += C[j];
    }

    writeln(x);
  }
}
