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