def main():
    a = int(input())
    b = int(input())
    middle = (a + b) // 2
    a = abs(a - middle)
    b = abs(b - middle)
    tiredness = lambda x: x * (x + 1) // 2
    t = tiredness(min(a, b)) * 2

    if a != b:
        t += max(a, b)

    print(t)


if __name__ == '__main__':
    main()
