first=int(input())
second=int(input())

fn=0
sn=0
z=abs(first-second)

mas=[]
while True:
  if z>0:
    z=z-1
    sn=sn+1
    mas.append(sn)
    if z>0:
      z=z-1
      fn=fn+1
      mas.append(fn)
  else:  
    break

print(sum(mas))