a,b,c,d=map(int, input().split()) ans = (b-a+1) * (d-c+1) l, r = max(a,c), min(b,d) if l <= r: dup = r-l + 1 ans -= dup print(ans)