{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
import qualified Data.IntMap   as I
import           Data.IORef
import qualified Data.Map      as M
import           Data.Maybe
import qualified Data.Set      as S
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import qualified Data.Vector   as V
import           System.IO

main :: IO ()
main = travelingBudget

travelingBudget :: IO ()
travelingBudget = do
  a :: Int <- readLn
  b :: Int <- readLn
  c :: Int <- readLn
  d :: Int <- readLn
  let bs = min a b
      tr = min c d
  print $ bs + tr