#include<iostream>

using namespace std;
 
const int Nmax = 501;
int N;
int C[Nmax], S[Nmax], F[Nmax];
 
int main() {
	cin >> N;
	for (int i = 1; i < N; i++) {
		cin >> C[i] >> S[i] >> F[i];
	}
 
	for (int i = 1; i <= N; i++) {
		int t = 0;
		for (int j = i; j < N; j++) {
			int t_dep = S[j];
			while (t_dep < t) {
				t_dep += F[j];
			}
			t = t_dep + C[j];
		}
		cout << t << endl;
	}
}