#include #include using namespace std; int main() { int T[10]; int Mx=0; int perm[10]={0, 1, 2, 3, 4}; scanf ("%d%d%d%d", T+1, T+2, T+3, T+4); do { int sum=T[perm[1]]*T[perm[2]]+T[perm[3]]*T[perm[4]]; Mx=max (sum, Mx); } while (next_permutation(perm+1, perm+5)); printf ("%d\n", Mx); return 0; }