import Control.Applicative main :: IO () main = solve <$> f >>= print where f = map read <$> words <$> getLine solve :: [Int] -> Int solve [a1, a2, a3, b] = max (a1 + a2 + a3 + b) (3 * a3)