#include <bits/stdc++.h>
using namespace std;
char arr[8][8];
int main() {
  int n, m;
  cin >> n >> m;
  int mn = min(n, m);
  int mx = max(n, m);
  int teams = mx / 2;
  int mod = mx % 2;
  if (teams >= mn) {
    cout << mn << endl;
  }
  if (teams < mn) {
    mn -= teams;
    mod += mn;
    if (mod >= 3) {
      mod /= 3;
      teams += mod;
    }
    cout << teams << endl;
  }
}
