func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, c0, d0;     cin >> n >> m >> c0 >> d0;     long long a[m + 4], b[m + 5], c[m + 5], d[m + 5];     for (int i = 1; i <= m; i++) {       cin >> a[i] >> b[i] >> c[i] >> d[i];       a[i] /= b[i];     }     c[0] = c0;     a[0] = 1005;     long long dp[n + 4][m + 4];     memset(dp, 0, sizeof(dp));     for (long long i = 1; i <= n; i++) {       for (long long j = 0; j <= m; j++) {         for (long long k = 0; k <= a[j]; k++) {           if (i - c[j] * k < 0) break;           if (j == 0) {             dp[i][j] = k * d0;           } else {             dp[i][j] = max(dp[i - c[j] * k][j - 1] + k * d[j], dp[i][j]);           }         }       }     }     cout << dp[n][m] << endl;   }   