import Data.List
import Data.Bits
import Data.List.Split
import Control.Monad

main = do
  a <- replicateM 2 getLine
  b <- replicateM 2 getLine
  print $ (minimum $ map (read::String->Int) a) + (minimum $ map (read::String->Int) b)