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

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

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