#include <iostream>     // std::cout
#include <algorithm>    // std::sort
#include <vector>       // std::vector

using namespace std;

int main()
{
    int el[4]; for (int i = 0; i < 4; ++i) cin >> el[i]; sort(el + 0, el + 4); cout << el[0] * el[1] + el[2] * el[3];
}