func_code_string: #include <bits/stdc++.h>   template <class T>   T gcd(T a, T b) {     while (a && b)       if (a > b)         a %= b;       else         b %= a;     return a + b;   }   using namespace std;   long long k, n[3], t[3], ans[11111][3], i, j;   int main() {     cin >> k >> n[0] >> n[1] >> n[2] >> t[0] >> t[1] >> t[2];     for (i = 0; i < k; i++)       for (j = 0; j < 3; j++) {         if (i == 0 && j == 0)           ans[i][j] = t[0];         else if (i == 0)           ans[i][j] = ans[i][j - 1] + t[j];         else if (i < n[j])           if (j == 0)             ans[i][j] = t[j];           else             ans[i][j] = ans[i][j - 1] + t[j];         else if (j == 0)           ans[i][j] = ans[i - n[j]][j] + t[j];         else           ans[i][j] = max(ans[i - n[j]][j] + t[j], ans[i][j - 1] + t[j]);       }     cout << ans[k - 1][2];     return 0;   }   