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






