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