def f(res,i)
  return res ^ i
end


A,B = readline.chomp.split.map(&:to_i)
res = nil
ary = []

if ((A - B) % 2 == 0)
  if (A % 2 == 0) && (B % 2 == 1)
    res = 0
  elsif (A % 2 == 0) && (B % 2 == 0)
    res = f(0,B)
  elsif (A % 2 == 1) && (B % 2 == 0)
    res = f(A,B)
  else
    res = f(A,0)
  end
else ((A - B) % 2 == 1)
  if (A % 2 == 0) && (B % 2 == 1)
    res = 1
  elsif (A % 2 == 0) && (B % 2 == 0)
    res = f(1,B)
  elsif (A % 2 == 1) && (B % 2 == 0)
    res = f(A,B)
  else
    res = f(A,1)
  end
end

p res