#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
    int v[6];
    scanf("%d%d%d%d",&v[1],&v[2],&v[3],&v[4]);
    sort( v+1, v+5 );
    printf("%d",v[1]*v[2]+v[3]*v[4]);
    return 0;
}