solver::Int->Int->Int->Int->Int
solver a b c d = minimum [x+y|x<-[a,b],y<-[c,d]]

main::IO()
main=do
  a'<-getLine
  b'<-getLine
  c'<-getLine
  d'<-getLine
  let a:b:c:d:[]=map read [a',b',c',d']::[Int]
  print (solver a b c d) 