#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  ll N;
  cin >> N;
  vector<ll> C(N), S(N), F(N);
  REP(i, 0, N - 1) cin >> C[i] >> S[i] >> F[i];

  REP(i, 0, N) {
    ll ans = 0;
    REP(j, i, N - 1) {
      ll t = max(S[j], ans);
      ans = (t + F[j] - 1) / F[j] * F[j] + C[j];
    }
    cout << ans << endl;
  }
}
