#include using namespace std; int main() { int x, y; cin >> x >> y; if ((y - x + 12) % 12 == 4) cout << (y + 4) % 12 << endl; else cout << (x + 4) % 12 << endl; }