#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  int teams = 0;
  int greatest;
  int smallest;
  cin >> m >> n;
  if (m > n) {
    greatest = m;
    smallest = n;
  } else {
    greatest = n;
    smallest = m;
  }
  if (greatest >= 2 * smallest) {
    teams += smallest;
  } else {
    teams += greatest - smallest;
    greatest -= teams * 2;
    smallest -= teams;
    teams += floor(smallest * 2 / 3);
  }
  cout << teams;
  return 0;
}
