a = input()
b = input()
p = min(a,b)
q = max(a,b)
ans = -1
for x in range(p,q+1):
	t = 0
	dp = x - p
	dq = q - x
	for y in range(0,dp+1):
		t += y
	for y in range(0,dq+1):
		t += y
	if ans == -1:
		ans = t
	elif t < ans:
		ans = t
print ans