#include <bits/stdc++.h>
using namespace std;
long long res, rec, d, h, v, e, p = 3.1415926535;
int main() {
  cin >> d >> h;
  if (d == 1 && h == 1) {
    cout << 0;
    return 0;
  }
  while (d != 0 && h != 0) {
    if (d <= h) {
      d++;
      h -= 2;
    } else if (d > h) {
      d -= 2;
      h++;
    }
    e++;
  }
  cout << e;
  return 0;
}
