a = int(input())
b = int(input())
best = 10**18
def dist(a, b):
    l = max(a - b, b - a)
    if l == 0: return 0
    return l * (l + 1) // 2
for x in range(1, 2000):
    best = min(best, dist(x, a) + dist(x, b))
print(best)
