import sys
import itertools as it

a = int(sys.stdin.readline())
b = int(sys.stdin.readline())

if a > b: a,b = b,a

m = (a+b)//2

r = sum(range(0,m+1-a))+sum(range(0,b+1-m))

print(r)
#a,p = map(int, sys.stdin.readline().split())
