
n=int(input())
m=int(input())
if (n-m==1) or (m-n==1):
    x = 1
elif(n>m) and n-m!=1:
    x=0
    for i in range(0,(n-m)+1):
        x+=i
elif(m>n) and m-n!=1:
    x=0
    for i in range (0,(m-n)+1):
        x+=i
print(x)






