include “stdio.h”
struct good{
int v;
int w;
}goods[11010];
int dp[2010]={0};
int max(int a,int b){
return a>b?a:b;
}
int main(){
int N,V,v,w,s,top=0;
scanf(“%d%d”,&N,&V);
for(int i=1;i<=N;i){
scanf(“%d%d%d”,&v,&w,&s);
int k=1;
while(s>=k){
goods[top].v=vk;
goods[top].w=wk;
top;
s-=k;
k=2;
}
if(s>0){
goods[top].v=vs;
goods[top].w=w*s;
top++;
}
}
for(int i=0;i[HTML_REMOVED]=goods[i].v;j–){
dp[j]=max(dp[j],dp[j-goods[i].v]+goods[i].w);
}
}
printf(“%d”,dp[V]);
return 0;
}