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