#include using namespace std; int main() { int l[3]; for(int i=0;i<3;i++){cin>>l[i]; l[i] *= 2; } sort(l, l+3); int m[3]; for(int i=0; i<3; i++) { cin >> m[i]; } sort(m, m+3, greater()); cout << (l[0] + l[1])*m[0] + (l[0] + l[2])*m[1] + (l[1] + l[2])*m[2] << endl; return 0; }