N,M=map(int,input().split()) dp=[0]*(M+1) L=[] for i in range(N): cp=[-10**17]*(2*(M+1)) for j in range(M+1): cp[2*j]=dp[j] a,b,c=map(int,input().split()) for j in range(a,M+1): cp[2*j+1]=dp[j-a]+b*c for j in range(a,M+1): cp[2*j+1]=max(cp[2*j+1],cp[2*(j-(a-b))+1]+b*c) for j in range(M+1): dp[j]=max(dp[j],cp[2*j+1]) for j in range(1,M+1): print(dp[j])