#import <stdio.h>
#define MAX(a,b) ((a)>(b)?(a):(b))
int CEIL(double x){
    int n = (int)x;
    return n + (((x != n) && (x > 0)) ? 1 : 0);
}

int WAIT(int t, int s, int f){
    return CEIL((double)(MAX(t,s))/f)*f-t;
}

int main(){
    int N;
    int C[200] = {0};
    int S[200] = {0};
    int F[200] = {0};
    scanf("%d",&N);
    for(int i=1;i<=N-1;i++){
        int c,s,f;
        scanf("%d %d %d",&c,&s,&f);
        C[i] = c;
        S[i] = s;
        F[i] = f;
    }
    for(int i=1;i<=N-1;i++){
        int t = S[i] + C[i];
        for(int j=i+1;j<=N-1;j++){
            t += WAIT(t,S[j],F[j]) + C[j];
        }
        printf("%d\n",t);
    }
    printf("0\n");
}
