#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; void solve(){ ll a,b,c; cin>>a>>b>>c; ll s,t,u; cin>>t>>u>>s; ll target[]={a+1,a,b-2,b-1,b,b+1,b+2,c+1,c}; ll ans = longinf; rep(i,9)rep(j,9)rep(k,9){ ll x = target[i],y=target[j],z=target[k]; if(xx && y>z) ans = min(ans,-s*(a-x)-t*(b-y)-u*(c-z)); if(y>t; rep(i,t)solve(); return 0; }