import kotlin.math.* fun main(args: Array) { val (a, b, c, d) = readLine()!!.split(" ").map(String::toInt) // val red = (a..b).toList() // val black = (c..d).toList() val all = (b - a + 1) * (d - c + 1) val same = max(0, min(b, d) - max(a, c) + 1) println(all - same) }