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


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


if(A == B)
  p A
elsif( A % 2 == 0)
  # 2,3 => 2 ^ 3
  if((B-A)%4== 1)
    p 1
  # 2,3,4 => 1 ^ 4
  elsif((B-A)%4 == 2)
    p 1 ^ B
  # 2,3,4,5 => 1 ^ 1 => 0
  elsif((B-A)%4 == 3)
    p 0
  # 2,3,4,5,6 => 1 ^ 1 ^ 6 => 0 ^ 6 => 6
  elsif((B-A)%4 == 0)
    p B
  # 2,3,4,5,6,7 = 1 ^ 1 ^ 1 => 0 ^ 1 => 1
  # elsif()
  #   p 1
  # # 2,3,4,5,6,7,8 = 1 ^ 1 ^ 1 ^ 8 => 1 ^ 8
  # elsif()

  # # 2,3,4,5,6,7,8,9 = 1 ^ 1 ^ 1 ^ 1 => 1 ^ 1 => 0
  # elsif()

  end
else
  # 3,4 => 3 ^ 4
  if((B-A)%4== 1)
    p A ^ B
  # 3,4,5 => 3 ^ 1
  elsif((B-A)%4== 2)
    p A ^ 1
  # 3,4,5,6 => 3 ^ 1 ^ 6
  elsif((B-A)%4== 3)
    p A ^ 1 ^ B
  # 3,4,5,6,7 = 3 ^ 1 ^ 1 => 3 ^ 0 => 3
  elsif((B-A)%4== 0)
    p A
  # 3,4,5,6,7,8 = 3 ^ 1 ^ 1 ^ 8 => 3 ^ 0 ^ 8 => 3 ^ 8
  # elsif()
  #   p A ^ B
  # # 3,4,5,6,7,8,9 = 3 ^ 1 ^ 1 ^ 1 => 3 ^ 1
  # elsif()
  
  end
end

# if ((A - B) % 2 + 1 == 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 == 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
