import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

long f(ulong x) {
  long t = (x + 1) / 2;

  if ((x + 1) % 2 == 0) {
    return t % 2;
  } else {
    return (t % 2) ^ x;
  }
}

void main() {
  long[] AB = readln.chomp.split.to!(long[]);
  long A = AB[0],
      B = AB[1];
  long ans = f(B);

  if (A > 0) {
    ans ^= f(A - 1);
  }

  writeln(ans);
}
