#include using namespace std; int main() { int A, B; cin >> A >> B; int N = A + B; int flag = 0; if( B > A ) flag = 1; int ans = 0; for( int i = 0; i < N; i++ ) { if( A <= 0 || B <= 0 ) break; if( flag ) B--; else A--; ans ++; flag = 1 - flag; } cout << ans << endl; }