#include #include using namespace std; int a[10]; int n = 4; int main() { //freopen ("a.in", "r", stdin); scanf ("%d %d %d %d", &a[1], &a[2], &a[3], &a[4]); int smax = -0x3f3f3f3f, s; do { s = a[1] * a[2] + a[3] * a[4]; if (smax < s) smax = s; } while (next_permutation(a + 1, a + n + 1)); printf ("%d\n", smax); }