pos_a=int(input())
pos_b=int(input())
jarak_a=int(abs(pos_b-pos_a)/2)
c=abs(pos_b-pos_a)%2

if (pos_a!=pos_b) and (1<=pos_a<=1000) and (1<=pos_b<=1000):
    if (c==0):
        tired1=int(jarak_a**2+jarak_a)
        print(tired1)
    elif(c==1):
        tired2=int(jarak_a**2+2*jarak_a+1)
        print(tired2)