#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, ans = 0;
  cin >> a >> b;
  while ((min(a, b) >= 1) && ((a != 1) || (b != 1)))
    if (a > b) {
      a -= 2;
      b++;
      ans++;
    } else {
      b -= 2;
      a++;
      ans++;
    }
  cout << ans << endl;
  return 0;
}
