#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
int C[500], S[500], F[500];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		cin >> C[i] >> S[i] >> F[i];
	}
	for (int k = 0; k < N; k++) {
		int t = 0;
		for (int i = k; i < N - 1; i++) {
			if (t < S[i]) t = S[i] + C[i];
			else t = t + (F[i] - t%F[i]) % F[i] + C[i];
		}
		cout << t << endl;
	}
}