#include using namespace std; int main() { vector a( 4 ); for( int i = 0; i < 4; i++ ) cin >> a[i]; int ans = 0; for( int i = 0; i < 4; i++ ) ans += a[i]; int ma = 0; for( int i = 0; i < 3; i++ ) ma = max( ma, a[i] ); ans = max( ans, ma * 3 ); cout << ans << endl; }