fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toLong() }
    println(xorFromZero(a - 1) xor xorFromZero(b) )
}

fun xorFromZero(n: Long): Long {
    val ans = when (n % 4.toLong()) {
        0.toLong() ->  n
        1.toLong() ->  1
        2.toLong() ->  1.toLong() xor n
        3.toLong() ->  0
        else -> 0
    }
    return ans.toString().toLong()
}
