import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto data = readln.split;
	auto A = data[0].to!long, B = data[1].to!long;
	
	long f(long n) { switch(n%4) {
		case 0: return n;
		case 1: return 1;
		case 2: return 1+n;
		case 3: return 0;
		default: return 0;
	} }
	if (A == 1) writeln(f(B));
	else { writeln(f(A-1) ^ f(B)); }
}
