a, b, c, d = map(int, input().split()) res = (b - a + 1) * (d - c + 1) for i in range(min(a, b, c, d), max(a, b, c, d) + 1): if a <= i and i <= b and c <= i and i <= d: res -= 1 print(res)