#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { int L[3]; int R[3]; for ( int i = 0; i < 3 ;i++ ) { cin >> L[i]; } for ( int i = 0; i < 3 ;i++ ) { cin >> R[i]; } vector A; A.push_back(L[0]*2+L[1]*2); A.push_back(L[1]*2+L[2]*2); A.push_back(L[0]*2+L[2]*2); sort( A.begin(), A.end() ); int ans = INT_MAX; do { int l = 0; for ( int i = 0; i < 3 ;i++ ) { l += A[i]*R[i]; } ans = min( ans, l ); } while ( next_permutation( A.begin(), A.end() ) ); cout << ans << endl; return 0; }