fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val A = sc.next().toInt()
    val B = sc.next().toInt()
    val C = sc.next().toInt()
    val D = sc.next().toInt()
    println( (if (A < B) A else B ) + (if (C < D) C else D ) )
}