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((B/2%2 == 1 ? 0 : 1) ^ ((A-1)/2%2 == 1 ? 0 : 1) ^ (B/2==1?0:B) ^ ((A-1)/2==1?0:A-1));
}