#include using namespace std; int main() { int X, Y; cin >> X >> Y; if( X > Y ) swap( X, Y ); int d = Y - X; int ans = ( Y + 4 ) % 12; if( d == 8 ) ans = ( X + 4 ) % 12; cout << ans << endl; }