a=int(input())
b=int(input())
c=(a+b)//2
if b>a:
    x=0
    y=0
    for n in range(1,b-c+1):
            x=x+n
    for n in range(1,c-a+1):
            y=y+n
    z=x+y
    print(z)
elif a>b:
    x=0
    y=0
    for n in range(1,a-c+1):
            x=x+n
    for n in range(1,c-b+1):
            y=y+n
    z=x+y
    print(z)
