a = int(input())
b = int(input())
diff = abs(b-a)
sumVal = 0
if diff%2:
    num = int(diff/2)
    for i in range(1,num+1):
        sumVal = sumVal + i
    ans = sumVal*2 + num+1
else:
    num = int(diff/2)
    for i in range(1,num+1):
        sumVal = sumVal + i
    ans = sumVal*2

print(ans)