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