import math
a_tired = 0
b_tired = 0
a = int(input())
b = int(input())

point = (a+b)//2

b_route = abs(b - point)
a_route = abs(a - point)

for i in range(1,a_route+1):
	a_tired +=i 
for i in range(1,b_route+1):
	b_tired +=i

total = a_tired + b_tired
print(str(total))