fun main(args: Array<String>){
    var a = readLine()!!.toInt()
    val b = readLine()!!.toInt()
    var c = readLine()!!.toInt()
    val d = readLine()!!.toInt()
    if(a>b){
        a=b
    }
    if(c>d){
        c=d
    }
    print(a+c)
}