#include #include #include using namespace std; int main() { int N, X, Y; cin >> N >> X >> Y; vector> dp(X + 1, vector(Y + 1, 0)); for (int k = 0; k < N; k++) { int A, B, C; cin >> A >> B >> C; for (int i = X; i >= A; i--) { for (int j = Y; j >= B; j--) { dp[i][j] = max(dp[i][j], dp[i - A][j - B] + C); } } } int maxVal = 0; for (int i = 0; i <= X; i++) { for (int j = 0; j <= Y; j++) { maxVal = max(maxVal, dp[i][j]); } } cout << maxVal << endl; return 0; }