#include using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back((a)) #define all(x) (x).begin(),(x).end() #define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x)) #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))< ostream& operator<<(ostream& o, const pair &p){o<<"("< ostream& operator<<(ostream& o, const vector &v){o<<"[";for(T t:v){o<>l1>>l2>>l3>>a>>b>>c; auto calc = [&](int r, int g, int b){ return (l1+l2)*r + (l2+l3)*g + (l1+l3)*b; }; vector cand; cand.pb(calc(a,b,c)); cand.pb(calc(a,c,b)); cand.pb(calc(b,a,c)); cand.pb(calc(b,c,a)); cand.pb(calc(c,a,b)); cand.pb(calc(c,b,a)); cout << 2 * (*min_element(all(cand))) << endl; return 0; }