#include using namespace std; int main() { int x, y, z, b; cin >> x >> y >> z >> b; int l = x + y + z + b, r = (max({x, y, z}))*3; cout << max(l, r) << endl; return 0; }