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) { final switch(n%4) {
		case 0: return n;
		case 1: return 1;
		case 2: return 1^n;
		case 3: return 1;
	}}
	
	writeln(f(A-1) ^ f(B));
}
