a = int(input())
b = int(input())
if a > b:
    a, b = b, a
ans = 100000000000000000000000000
for i in range(a, b + 1):
    x = ((i - a) * (i - a + 1)) // 2
    y = ((b - i) * (b - i + 1)) // 2
    ans = min(ans, x + y)
print(ans)