a = int(input())
b = int(input())
move = b - a if b - a > 0 else a - b
if move % 2==0:
    one_move = move//2
    print(int(2 * ((1+one_move)*(one_move/2))))
else:
    one_move = (move - 1)//2
    print(int(2 * ((1+one_move)*(one_move/2)) + (one_move + 1)))