// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var numStation = Number(line[0]);

	var takeTime = [];
	var firstTime = [];
	var period = [];

	for(var i = 1; i < numStation; i++){
		var tmp = line[i].split(" ");
		takeTime.push(Number(tmp[0]));
		firstTime.push(Number(tmp[1]));
		period.push(Number(tmp[2]));
		// departureTime = firstTime + period * i
		// arrivalTime = departureTime + takeTime
	}

	var minTime = [];
	var ans = [];

	for(var j = 0; j < numStation; j++){

		minTime[j] = [];

		for(k = j; k < numStation; k++){
			if(k === j){
				minTime[j][k] = 0;
			} else if(k === j+1){
				minTime[j][k] = firstTime[j] + takeTime[j];
			} else{
				if(minTime[j][k-1] <= firstTime[k-1]){
					minTime[j][k] = firstTime[k-1] + takeTime[k-1];
				} else{
					var waitTime;
					if((minTime[j][k-1]-firstTime[k-1])%period[k-1] === 0){
						waitTime = 0;
					} else{
						waitTime = period[k-1] - (minTime[j][k-1]-firstTime[k-1])%period[k-1];
					}
					minTime[j][k] = minTime[j][k-1] + waitTime + takeTime[k-1];
				}
			}
		}

		ans[j] = minTime[j][numStation-1];
	}

	console.log(ans.join("\n"));


}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));