#include <cstdio>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <cstring>
#include <string>
#include <set>
#include <stack>
#define pb push_back

#define mp make_pair
#define f first
#define s second
#define ll long long

using namespace std;

int main() {
    

    vector <int> v(4);

    cin >> v[0] >> v[1] >> v[2] >> v[3];

    sort(v.rbegin(), v.rend());
    
    cout << v[0] * v[1] + v[2] * v[3] ;
    return 0;
}