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