#include<iostream>

using namespace std;

int main(){
    int n, c[509], s[509], f[509];
    cin >> n;
    for(int i=0;i<n-1;i++){
        cin >> c[i] >> s[i] >> f[i];
    }
    for(int i=0;i<n;i++){
        int cur = 0;
        for(int j=i;j<n-1;j++){
            cur = max(s[j], ((cur-1)/f[j]+1)*f[j]);
            cur += c[j];
        }
        cout << cur << endl;
    }
}