def sumArif(a1,n):
	return ((2*a1+ n - 1)/2) * n
	
a = int(input())
b = int(input())
minn = 0
maxx = 0
if (a > b):
	maxx = a
	minn = b
else: 
	maxx = b
	minn = a
delta = maxx - minn 
if delta % 2 == 1:
	print(int(sumArif(1,delta//2)*2 + delta // 2 + 1))
else:
	print(int(sumArif(1,delta//2)*2))