object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val a = sc.nextLong
    val b = sc.nextLong

    println(f(a-1)^f(b))
  }

  def f(n:Long) : Long = {
    (n+1) % 4 match {
      case 0 => 0
      case 1 => n
      case 2 => 1
      case 3 => 1^n
    }
  }

}