#include #include #include using namespace std; int st[10]; int a[10]; int maxim = 0; int main() { cin >> a[1] >> a[2] >> a[3] >> a[4]; for ( int i = 1; i <= 4; ++i ) st[i] = i; do { maxim = max( maxim, a[ st[1] ] * a[ st[2] ] + a[ st[3] ] * a[ st[4] ] ); } while ( next_permutation( st + 1, st + 4 + 1 ) ); cout << maxim; return 0; }