#include <bits/stdc++.h>
using namespace std;
int isprime(int n);
int main() {
  long long a, b;
  cin >> a >> b;
  int ans = 0;
  while (a > 0 and b > 0 and a + b >= 3) {
    if (a < b)
      a--, b -= 2;
    else
      b--, a -= 2;
    ans++;
  }
  cout << ans << "\n";
  return 0;
}
