fun MM(x:Int, y:Int):Int{
  if(x>y) return y
  return x
}

fun main(args: Array<String>) {
    val da:Array<Int> = Array(4){
      readLine()!!.toInt()
    }
    println(MM(da[0],da[1])+MM(da[2],da[3]))
}