x1 = int(input())
x2 = int(input())
minimum = 1000000000000
def distance(p, x1, x2):
    dx1 = 0
    dx2 = 0
    for i in range(1, abs(x1 - p) + 1):
        dx1 += i
    for i in range(1, abs(x2 - p) + 1):
        dx2 += i
    return dx1 + dx2
for i in range(1000):
    t = distance(i+1, x1, x2)
    minimum = min(minimum, t)
print(minimum)