#include <iostream>
#include <algorithm>
using namespace std;
int v[10], i;

int main() {
    cin >> v[1] >> v[2] >> v[3] >> v[4];

sort(v + 1, v + 5);

cout << v[1] * v[2] + v[3] * v[4] << '\n';

return 0;
}