f1=int(input())
f2=int(input())
x=max(f1,f2)
y=min(f1,f2)
z=x-y
a=0
b=0
if z%2==0:
	w=int(z/2)
	for i in range(1,w+1):
		b=b+i
	print(2*b)
else:
	w=int(z/2)
	for i in range(1,w+1):
		a=a+i
	for i in range(1,w+2):
		b=b+i
	print(a+b)