object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').map(_.toLong).toSeq)
  val A = ls(0)(0)
  val B = ls(0)(1)
  val rA = (A+4) % 4
  val rB = B % 4
  var r = 0L
  if(rA<=4) {r = r ^ (A+0); println(A+0);}
  if(rA<=3) {r = r ^ (A+1); println(A+1);}
  if(rA<=2) {r = r ^ (A+2); println(A+2);}
  if(rA<=1) {r = r ^ (A+3); println(A+3);}

  if(rB>=3 || rB==0) {r = r ^ (B-3); println(B-3);}
  if(rB>=2||rB ==0) {r = r ^ (B-2); println(B-2);}
  if(rB>=1||rB==0) {r = r ^ (B-1); println(B-1);}
  if(rB>=0) {r = r ^ (B-0); println(B-0);}
  println(r)
}
