import std.stdio,
       std.string,
       std.conv,
       std.algorithm;

void main() {
  int N = readln.chomp.to!(int);
  int[] C, S, F;
  for (int i = 0; i < N - 1; i++) {
    int[] buf = readln.chomp.split.to!(int[]);
    C ~= buf[0];
    S ~= buf[1];
    F ~= buf[2];
  }

  for (int i = 0; i < N - 1; i++) {
    int x = S[i] + C[i];
    for (int j = i + 1; j < N - 1; j++) {
      if (x > S[j]) {
        int t = (x - S[j]) % F[j];
        if (t) {
          x += F[j] - t;
        }
      }
      else {
        x += S[j] - x;
      }
      x += C[j];
    }
    writeln(x);
  }
  writeln(0);
}
