#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const double PI = 3.14159265358979;
const ll INF = pow(10, 18);
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ll f(ll x) {
  if (x % 4 == 3) {
    return 0;
  } else if (x % 4 == 1) {
    return 1;
  } else if (x % 4 == 2) {
    return 1 + x;
  } else
    return x;
}
int main() {
  ll a, b;
  cin >> a >> b;
  a--;
  ll s = f(b), t = f(a);
  s = s ^ t;
  cout << s << endl;
}
