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

main :: IO ()
main = do
    input <- getLine
    let [a, b, c, d, e, f] = map read $! lines input
        abcd = mymin (mymin a b) (mymin c d)
        ef = mymin e f
    putStrLn $ show $ a + b + c + d + e + f - abcd - ef
    return ()
