#include using namespace std; int main() { int x, y, z,k; cin >> x >> y; z = max(x, y); k = min(x, y); if (z < 8) cout << z + 4 << endl; else if(z>=8 and k>z-8) cout << z-8 << endl; else cout << k+4 << endl; return 0; }