let n = readLine()!.split(separator: " ").map{Int($0)!} let A = (Array)(n[0]...n[1]) let B = (Array)(n[2]...n[3]) let S = Set(A + B) print(A.count * B.count - (Array(A + B).count - S.count))