# import sys
# from io import StringIO
# sys.stdin = StringIO(open(__file__.replace('.py', '.in')).read())

a = int(input())
b = int(input())

c = min(a, b) + abs(a - b) // 2
sa = 0
sb = 0
for i in range(abs(a - c)):
    sa += i + 1
for i in range(abs(b - c)):
    sb += i + 1

print(sa + sb)
