import math

a = int(input())
b = int(input())
bar = 0
foo = 0
k=0
c = max(abs(a), abs(b)) - min(abs(a), abs(b))
if c % 2 == 0:
	k = int(c/2+1)
	
	for i in range(1, k):
		bar+=i 
	bar*=2
if c % 2 != 0:
	for i in range(1, math.ceil(c/2)+1):
		bar +=i
	for i in range(1, math.floor(c/2)+1):
		foo+=i
	bar+=foo

print(bar)
