min :: Int -> Int -> Int
min r l
    | r<l = r
    | otherwise = l

main :: IO ()
main = do
    input <- getLine
    let [A, B, C, D, E, F] = map read $ words input :: [Int]
        ABCD = min $ min A B min C D
        EF = min E F
    putStrLn $ show $ A + B + C + D + E + F - ABCD - EF
    return ()
