# Friends Meeting
def tired(a, b):
    diff = abs(a - b)
    if diff & 1 == 0:
        diff //= 2
        ans = (diff * (diff + 1)) // 2
        return 2 * ans
    x = diff // 2
    y = x + 1
    ans = ((x * (x + 1)) // 2) + ((y * (y + 1)) // 2)
    return ans


a = int(input())
b = int(input())
print(tired(a, b))
