object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val A, B = sc.nextLong()
    println(
      if (A % 2 == 0 && B % 2 == 0)
        if ((B - A) % 4 != 0)
          1 ^ B
        else
          B
      else if (A % 2 == 0)
        if ((B - A + 1) % 4 != 0)
          1
        else
          0
      else if (B % 2 == 0)
        if ((B - A - 1) % 4 != 0)
          1 ^ A ^ B
        else
          A ^ B
      else if ((B - A) % 4 != 0)
        1 ^ A
      else
        A)
  }
}
