#include typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1e9+7; main(){ int L1,L2,L3,C[3]; cin >> L1 >> L2 >> L3 >> C[0] >> C[1] >> C[2]; int L[] = {2*(L1+L2),2*(L2+L3),2*(L3+L1)}; sort(L,L+3); sort(C,C+3); cout << L[0]*C[2] + L[1]*C[1] + L[2]*C[0] << endl; }