#include <bits/stdc++.h>
using namespace std;
int main() {
  int exp, nb;
  cin >> exp >> nb;
  int maxteams = (exp + nb) / 3;
  if (min(exp, nb) >= maxteams) {
    cout << maxteams << endl;
  } else {
    cout << min(exp, nb) << endl;
  }
}
