func_code_string: #include <bits/stdc++.h>   using namespace std;   long long dp[10][10000];   long long cnt[10];   long long w;   int32_t main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cin >> w;     for (long long i = 0; i < 8; i++) {       cin >> cnt[i];     }     for (long long i = 0; i < 10; i++)       for (long long j = 0; j < 10000; j++) dp[i][j] = -1;     dp[0][0] = 0;     for (long long i = 0; i < 8; i++) {       for (long long j = 0; j < 10000; j++) {         if (dp[i][j] == -1) continue;         long long b = 840 / (i + 1);         b = min(b, cnt[i]);         for (long long k = 0; k <= b; k++)           if (j + k * (i + 1) < 10000) {             dp[i + 1][j + k * (i + 1)] =                 max(dp[i + 1][j + k * (i + 1)],                     dp[i][j] + (cnt[i] - k) / (840 / (i + 1)));           }       }     }     long long ans = 0;     for (long long j = 0; j < 10000; j++) {       if (dp[8][j] != -1 && j <= w) {         ans = max(ans, j + 840ll * (min(dp[8][j], (w - j) / 840)));       }     }     cout << ans <<   n ;   }   