#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=5005;
const ll INF=1LL<<60;

ll dp[MAX*2][MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N,M;cin>>N>>M;
    for(int i=0;i<MAX*2;i++) for(int j=0;j<MAX;j++) dp[i][j]=-INF;
    dp[0][0]=0;
    
    for(int i=0;i<N;i++){
        ll a,b,c;cin>>a>>b>>c;
        for(int j=0;j<=M;j++){
            chmax(dp[2*(i+1)][j],dp[2*i][j]);
            if(j+a<=M) chmax(dp[2*i+1][j+a],dp[2*i][j]+b*c);
        }
        for(int j=a-b;j<=M;j++){
            chmax(dp[2*i+1][j],dp[2*i+1][j-(a-b)]+b*c);
        }
        for(int j=0;j<=M;j++) chmax(dp[2*(i+1)][j],dp[2*i+1][j]);
    }
    
    ll ma=0;
    for(int j=1;j<=M;j++){
        chmax(ma,dp[2*N][j]);
        cout<<ma<<"\n";
    }
}