func_code_string: #include <bits/stdc++.h>   int const MAX = 1e5 + 5;   using namespace std;   bool check(long long m, long long ai, long long di, long long hm, long long am,              long long dm) {     long long retval;     if (hm % (ai - dm) == 0)       retval = m - (((hm) / (ai - dm))) * (am - (di));     else       retval = m - (1 + ((hm) / (ai - dm))) * (am - (di));     if (retval > 0) return true;     return false;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long hy, hm, ay, am, dy, dm;     cin >> hy >> ay >> dy >> hm >> am >> dm;     long long h, a, d;     cin >> h >> a >> d;     long long ans = LLONG_MAX;     for (long long i = 0; i < 1000; i++) {       for (long long j = 0; j < 1000; j++) {         long long ai = ay + i;         long long di = dy + j;         long long c = a * i + d * j;         if (ai <= dm) continue;         long long l = 0, r = 10000;         while (r - l > 1) {           long long mid = (l + r) >> 1;           if (check(hy + mid, ai, di, hm, am, dm))             r = mid;           else             l = mid;         }         if (!check(hy + l, ai, di, hm, am, dm)) l++;         if (l < 0) l = 0;         c += l * h;         ans = min(ans, c);       }     }     cout << ans;   }   