#include #include using namespace std; int i,a[10]; int main() { //freopen("test.in","r",stdin); //freopen("test.out","w",stdout); for(i=1;i<=4;i++) scanf("%d",&a[i]); sort(a+1,a+4+1); printf("%d\n",a[4]*a[3]+a[2]*a[1]); return 0; }