def max(a, b) return a if a > b return b end def min(a, b) return a if a < b return b end ary = gets.chomp.split(" ") all = (ary[1].to_i - ary[0].to_i + 1) * (ary[3].to_i - ary[2].to_i + 1) print all - (min(ary[1].to_i, ary[3].to_i) - max(ary[0].to_i, ary[2].to_i) + 1)