#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c = 9990, ans = 0;
  cin >> a >> b;
  if (a == b && b == 1) {
    cout << 0;
    return 0;
  }
  while (1) {
    if (a > b) swap(a, b);
    a = min(c, a + 1);
    b -= 2;
    if (a <= 0 || b <= 0) break;
    ans++;
  }
  cout << ans + 1;
}
