#include <algorithm>
#include <iostream>
using namespace std;
int p[4];
int main() {
    cin >> p[0] >> p[1] >> p[2] >> p[3];
    sort(p, p + 4);
    int ans = 0;
    do {
        ans = max(ans, p[0] * p[1] + p[2] * p[3]);
    }while(next_permutation(p, p + 4));
    cout << ans;
    return 0;
}