a = int(input())

b =int(input())
c = (a+b)//2
d =0

g=0
e=1
f=1

if (a-b==1)or(b-a==1):
    print(1)
else:
    if a<b:
        for i in range(a,c):
            d = d+e
            e = e+1
        for j in range(c,b):
            g=g+f
            f=f+1
        print(d+g)
    else:
        for i in range(b,c):
            d = d+e
            e=e+1
        for j in range(c,a):
            g=g+f
            f=f+1
        print(d+g)
