a, b = $stdin.readline.split(" ").map(&:to_i)
l = b.to_s(2).length

if a == b
  puts a
else
  x = a
  a += 1
  while a % 4 > 0
    x ^= a
    a += 1
  end
  x ^= b
  while b % 4 > 0
    x ^= b
  end
end

puts x

