#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   int main() {     int hy, ay, dy;     int hm, am, dm;     int ph, pa, pd;     scanf( %d%d%d%d%d%d%d%d%d , &hy, &ay, &dy, &hm, &am, &dm, &ph, &pa, &pd);     int ans = INF, least = 0;     int cur_ay = ay;     if (cur_ay < dm + 1) {       least = pa * (dm + 1 - cur_ay);       cur_ay = dm + 1;     }     int tar_ay, tar_dy;     int c1, c2;     for (int k = 1; k <= 100; k++) {       c1 = least;       tar_ay = dm + hm / k + (hm % k ? 1 : 0);       if (tar_ay > cur_ay) c1 += (tar_ay - cur_ay) * pa;       tar_dy = am - hy / k + (hy % k ? 0 : 1);       if (tar_dy <= dy)         ans = min(ans, c1);       else {         for (int j = 0; dy + j < tar_dy; j++) {           c2 = c1 + j * pd + (k * (am - dy - j) - hy + 1) * ph;           if (c2 < ans) ans = c2;         }         ans = min(c1 + (tar_dy - dy) * pd, ans);       }     }     if (ans == INF) ans = 0;     printf( %d n , ans);     return 0;   }   