#include #include using namespace std; using namespace atcoder; using ll = long long; #define all(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < n; i++) int main(void) { ll x, y, z; cin >> x >> y; if((x + 8) % 12 == y) z = (x + 4) % 12; else z = (x + 8) % 12; cout << z << endl; return 0; }