#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
int n , W;
int v[N] , w[N] , m[N];
int v1[N] , w1[N] , m1[N];
int f[N];
int cnt;
void so1(int x){
// int t = 1;
// while(m[x] > t){
// m[x] -= t;
// t <<= 1;
// w1[++cnt] = t * w[x];
// v1[cnt] = t * v[x];
// }
for(int i = 1 ; i <= m[x] ; i <<= 1){
m[x] -= i;
v1[++cnt] = v[x] * i;
w1[cnt] = w[x] * i;
}
if(m[x]){
v1[++cnt] = v[x] * m[x];
w1[cnt] = w[x] * m[x];
}
}
int main(){
cin >> n >> W;
for(int i = 1 ; i <= n ; i++) cin >> v[i] >> w[i] >> m[i];
for(int i = 1 ; i <= n ; i++) so1(i);
for(int i = 1 ; i <= cnt ; i++)
for(int j = W ; j >= w1[i] ; j--)
f[j] = max(f[j] , f[j - w1[i]] + v1[i]);
cout << f[W];
return 0;
}
so1里被注释的部分和未被注释的if上面那一部分有什么区别吗