def soma(n):
    soma = 0
    for i in range(1, n + 1):
        soma += i
    return soma

a = int(input())
b = int(input())

dist = abs(a - b)
paraCada = dist // 2
if dist % 2 == 0:
    ans = soma(paraCada) * 2
else:
    ans = soma(paraCada) + soma(paraCada + 1)

print(ans)
	  	 	 	    		   	  			 		   		