# 包除原理 A, B, C, D = map(int, input().split()) total = (B-A+1) * (D-C+1) L = max(A,C) R = min(B,D) removed = max(0, R-L+1) ans = total - removed print(ans)