a = int(input())
b = int(input())


dis = abs(a-b)


def getSum(a):
    a = int(a)
    if a <=1:
        return a
    else:
        return (1+a)*a/2

if dis%2 == 0 :
    ans = getSum(dis/2) * 2
else:
    ans = getSum(dis/2) + getSum(dis/2 + 1)

print(int(ans))







