function xor(a,b){
  const m = 10000000;
  var tmp_up = (parseInt(a/m)^parseInt(b/m))*m;
  var tmp_down = (a%m)^(b%m);

  if(a<m && b<m){return tmp_down;}
  if(a<m){tmp_up = parseInt(b/m)*m;}
  if(b<m){tmp_up = parseInt(a/m)*m;}

  return tmp_down+tmp_up;
}

function acc_xor(n){
  if(n%4==0){
    return xor(0,n);
  }
  if(n%4==1){
    return 1;
  }
  if(n%4==2){
    return xor(1,n);
  }
  if(n%4==3){
    return 0;
  }

}

function main(input) {
  const formatted_input = input.split('\n');
  const A =  parseInt(formatted_input[0].split(' ')[0]);
  const B =  parseInt(formatted_input[0].split(' ')[1]);

  const acc_a = acc_xor(A-1);
  const acc_b = acc_xor(B);
  const result = xor(acc_a, acc_b)
  console.log(result);

//for(var i=0;i<16;i++){console.log(acc_xor(i).toString(2))}


}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

