a, b, c, d = map(int, input().split()) if a <= c: num = max(0, b-c+1) else: num = max(0, d-a+1) print((b-a+1)*(d-c+1)-num)