import std.conv, std.stdio;
import std.algorithm, std.array, std.range, std.string;
void main()
{
    auto buf = readln.chomp.split.to!(ulong[]);
    buf[0].solve(buf[1]).writeln;
}

ulong solve(in ulong a, in ulong b)
{
    assert (a <= b);
    if (a == b)
        return a;
    if (a.even && b.odd)
        return (~(b-a)>>1) & 1;
    if (a.odd)
        return a ^ solve(a + 1, b);
    if (b.even)
        return solve(a, b - 1) ^ b;
    assert (false);
}

bool even(in ulong a)
{
    return !(a & 1);
}
bool odd(in ulong a)
{
    return a & 1;
}
