func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX_N = 20;   int c[MAX_N], d[MAX_N], num[MAX_N];   int dp[MAX_N][MAX_N * 100];   int n, m, c0, d0, a, b;   int main() {     while (scanf( %d%d%d%d , &n, &m, &c0, &d0) != EOF) {       for (int i = 1; i <= m; i++) {         scanf( %d%d , &a, &b);         num[i] = a / b;         scanf( %d%d , &c[i], &d[i]);       }       memset(dp, 0, sizeof dp);       for (int i = 0; i <= n; i++) dp[0][i] = i / c0 * d0;       for (int i = 1; i <= m; i++)         for (int j = 0; j <= n; j++)           for (int k = 0; k <= num[i]; k++) {             if (j / c[i] < k) break;             dp[i][j] = max(dp[i][j], dp[i - 1][j - c[i] * k] + d[i] * k);           }       int res = 0;       for (int i = 0; i <= n; i++) res = max(res, dp[m][i]);       printf( %d n , res);     }     return 0;   }   