
let A = stdin.ReadLine() |> int
let B = stdin.ReadLine() |> int
let C = stdin.ReadLine() |> int
let D = stdin.ReadLine() |> int

let ab x y = 
 if x < y then x
 else y
 
let cd x y =
 if x < y then x
 else y
 
let sum x y =
 x + y

printfn "%d" (sum (ab A B) (cd C D))