fun main(args: Array<String>) {
    val (A, B) = listOfLong()
    fun f(v: Long): Long {
        val c = (v + 1) / 2
        val result = c % 2
        return if (v % 2 == 0L) result xor v else result
    }
    val ans = f(A - 1) xor f(B)
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map(String::toLong)