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