def ascan; gets.split.map(&:to_i); end

a,b,c,d = ascan

t = (b-a+1)*(d-c+1)
t -= [0,[b,d].min-[a,c].max+1].max
p t