#include using namespace std; int v[6]; void QuickSort (int l, int r) { int pv = v[(l + r) / 2], i = l, j = r; while (i <= j) { while (v[i] < pv) ++i; while (v[j] > pv) --j; if (i <= j) { int aux = v[i]; v[i] = v[j]; v[j] = aux; ++i; --j; } } if (l < j) QuickSort (l, j); if (i < r) QuickSort (i, r); } int main () { for (int i = 1; i <= 4; ++i) cin >> v[i]; QuickSort (1, 4); cout << v[4] * v[3] + v[2] * v[1] << "\n"; return 0; }