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