a = int(raw_input())
b = int(raw_input())
a, b = min(a, b), max(a, b)

t = 1000 * (1001)
def total(x):
    return x * (x + 1) / 2

for i in range(a, b + 1):
    r = total(i - a) + total(b - i)
    t = min(t, r)

print t
