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