include[HTML_REMOVED]
#include[HTML_REMOVED]
using namespace std;
const int NN= 1010;
int f[NN][NN], v[NN],m[NN] ,w[NN];
int main() {
int N,V,M;
cin >> N >> V>>M;
for (int i = 0; i < N; i) cin >> v[i]>>m[i] >> w[i];
for (int i = 0; i < N; i) {
for (int j = V; j >= v[i]; –j)
for (int k = M; k>= m[i]; –k){
f[j][k] = max(f[j][k], f[j - v[i]][k-m[i]] + w[i]);
}
} cout << f[V][M];
return 0;
}