// #define _GLIBCXX_DEBUG #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) int main() { // Input int A, B; cin >> A >> B; // All Search int ans = 0; vector p; rep(i, A) p.push_back(0); rep(i, B) p.push_back(1); do { int temp = 0; for (int i = 1; i < A + B; ++i) if (p[i] != p[i - 1]) ++temp; ans = max(ans, temp); } while (next_permutation(p.begin(), p.end())); // Output cout << ans << endl; }