import std.conv;
import std.stdio;
import std.string;

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


void main()
{
    ulong A, B;
    scan(A, B);
    writeln(f(A - 1) ^ f(B));
}

ulong f(ulong x)
{
    auto mod = x % 4;
    switch (mod)
    {
    case 0:
        return x;
    case 1:
        return 1;
    case 2:
        return x ^ 1;
    case 3:
        return 0;
    default:
        assert(0);
    }
}
