module Main where
import Control.Exception (bracket, finally)
import Control.Monad (forM_)
import System.IO
import System.Environment

main :: IO ()
main = do
  a <- (read :: String -> Int) <$> getArgs
  b <- (read :: String -> Int) <$> getArgs
  c <- (read :: String -> Int) <$> getArgs
  d <- (read :: String -> Int) <$> getArgs                                                                                 

  putStrLn $ min a b + min c d