#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = 1LL << 60;
using vll = vector<long long>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pair<long long, long long> = pair<long long, long long>;
int main() {
  long long n;
  cin >> n;
  vll c(n), s(n), f(n);
  for (long long i = 0; i < (n); i++) cin >> c[i] >> s[i] >> f[i];
  for (long long i = 0; i < (n); i++) {
    long long cu = 0;
    long long time = 0;
    for (int j = i; j < n; j++) {
      if (time < s[j]) {
        time = s[j];
      } else {
        long long d = time - s[j];
        long long k = d % f[j];
        long long h = f[j] - k;
      }
      time += c[j];
    }
    cout << (time) << endl;
  }
}
