a=int(input())
b=int(input())
c=(a+b)//2
d=0
e=1
if(a<c):
    for i in range(a,c):
        d=d+e
        e=e+1
else:
    for i in range(c,a):
        d=d+e
        e=e+1
e=1
if(b<c):
    for i in range(b,c):
        d=d+e
        e=e+1
else:
    for i in range(c,b):
        d=d+e
        e=e+1
print(d)