func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e3 + 10;   const int INF = 99999999;   const double eps = 1e-4;   int dp[MAXN];   int main() {     int n, m, c0, d0;     cin >> n >> m >> c0 >> d0;     memset(dp, 0, sizeof(dp));     for (int i = c0; i <= n; i++) dp[i] = i / c0 * d0;     for (int i = 1; i <= m; i++) {       int a, b, c, d;       cin >> a >> b >> c >> d;       for (int j = 1; j <= a / b; j++) {         for (int k = n; k >= c; k--) dp[k] = max(dp[k - c] + d, dp[k]);       }     }     cout << dp[n] << endl;     return 0;   }   