#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; using Data = pair>; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; int main() { int l1, l2, l3, r, b, y; cin >> l1 >> l2 >> l3 >> r >> b >> y; vectorlo = { l1 + l2,l2 + l3,l3 + l1 }; vectorcnt = { r,b,y }; sort(all(cnt)); int ans = 101010; do { ans = min(ans,2*(cnt[0] * lo[0] + cnt[1] * lo[1] + cnt[2] * lo[2])); } while (next_permutation(all(cnt))); cout << ans << endl; return 0; }