A, B = gets.split.map(&:to_i)

if B == 0
  ans = 0
else
  len = Math.log2(B).floor + 1
  xorA = (len-1).downto(0).map do |i|
    if i == 0
      a = A % 4; b = B % 4
      [0, 1, 0, 1, 0, 1, 0, 1][a, (4+b)-a+1].reduce(&:+) % 2
    else
      a = A % (2**(i+1)); b = B % (2**(i+1))
      ((a <= 2**i ? 2**i : 2**(i+1) - a) + (b < 2**i ? 0 : b - 2**i + 1)) % 2
    end
  end
  ans = xorA.join("").to_i(2)
end

print("#{ans}\n")