#include <iostream>
#include <algorithm>
using namespace std;



int main()
{
	int v[4];

	cin >> v[0] >> v[1] >> v[2] >> v[3];
	sort(v, v + 4);
	cout << v[3] * v[2] + v[1] * v[0];

	return 0;
}