def dist(x, y):
    return abs(x - y)

def tired(x):
    return x * (x + 1) // 2

dyn_sum = [1000000000 for i in range(1000)]

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


for i in range(1, 1001):
    dyn_sum[i - 1] = tired(dist(a, i)) + tired(dist(i, b))

print(min(dyn_sum))
