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

main :: IO ()
main = do
  a <- getArgs
  b <- getArgs
  c <- getArgs
  d <- getArgs

  putStrLn $ min a b + min c d