n, m = map(int, input().split()) dp = [0] * (m + 1) for _ in range(n): a, b, c = map(int, input().split()) d = a - b ndp = [-1 << 30] * (m + 1) for i in range(m - a + 1): ndp[i + a] = dp[i] + c * b for i in range(d, m + 1): ndp[i] = max(ndp[i], ndp[i - d] + c * b) for i in range(m + 1): dp[i] = max(ndp[i], dp[i]) print(*dp[1:], sep="\n")