strToInt :: String -> Int
strToInt s = read s :: Int

main = do
    a <- getLine 
    b <- getLine
    c <- getLine
    d <- getLine
    let train = min (strToInt a) (strToInt b)
        bus = min (strToInt c) (strToInt d)
    putStrLn $ show (train + bus)