mymin :: Int -> Int -> Int
mymin =  \r l -> if r<l then r else l

main :: IO ()
main = do
    input <- getContents --ここ間違ってた
    let [a, b, c, d, e, f] = map read $ words input
    putStrLn $ show $ a + b + c + d + e + f - (mymin (mymin a b) (mymin c d)) - (mymin e f)
