def sumOneToN(n):
    return int(n*(n+1)/2)


def main():
    a = int(input())
    b = int(input())
    d = abs(a-b)
    if d & 1 == 0:
        print(2*sumOneToN(d/2))
    else:
        d -= 1
        print(sumOneToN(d/2) + sumOneToN(d/2 + 1))


if __name__ == "__main__":
    main()