import std.stdio, std.range, std.conv, std.string;
import std.algorithm.comparison, std.algorithm.iteration, std.algorithm.mutation, std.algorithm.searching, std.algorithm.setops, std.algorithm.sorting;

struct Strut{
    long A;
    long B;
}

void main()
{
    long[] input = readln().split.to!(long[]);
    long A = input[0];
    long B = input[1];
    writeln(f(A-1)^f(B));
}

long f(long x)
{
    switch(x%4)
    {
        case 0:
        return x;
        case 1:
        return 1;
        case 2:
        return x ^ 1;
        case 3:
        return 0;
        default:
        return 0;
    }
}