#include using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int n, m; cin >> n >> m; vector a(n), b(n); vector c(n); for (int i = 0; i < n; i++) { cin >> a[i] >> b[i] >> c[i]; } vector dp(m + 1, 0); for (int i = 0; i < n; i++) { for (int j = a[i]; j <= m; j++) { dp[j] = max(dp[j], dp[j - a[i] + b[i]] + c[i] * b[i]); } } for (int i = 1; i <= m; i++) { cout << dp[i] << "\n"; } }