include[HTML_REMOVED]
using namespace std;
int main()
{
int n, m, v[1001], w[1001], f[2001], s[1001], a[25000],b[25000];
cin >> n >> m;
memset(f, 0, sizeof(f));
for(int i = 0; i < n; i++)
cin >> v[i] >> w[i] >> s[i];
int total = 0;
for(int i =0;i[HTML_REMOVED]= b[i]; j–)
f[j] = max(f[j], f[j - b[i]] + a[i]);
cout << f[m] << endl;
return 0;
}