#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <cstdio>
#include <string>

using namespace std;

int main() {
  int x, y;
  cin >> x >> y;
  int a = (x + 4) % 12;
  int b = (x + 8) % 12;
  cout << (y ^ a ^ b) << endl;
  return 0;
}