a = int(input())
b = int(input())
d = abs(a - b)
if (d % 2 == 0):
    tmp = d // 2
    print(2 * (1 + tmp) * tmp // 2)
else:
    tmp = d // 2
    first = (1 + tmp + 1) * (tmp + 1) // 2
    second = (tmp + 1) * tmp // 2
    print(first + second)