#include <bits/stdc++.h>
using namespace std;
const int con = static_cast<const int>(1e4 + 5);
const int MOD = 1000000007;
int main() {
  int experienced, inexperienced;
  cin >> experienced >> inexperienced;
  int total = experienced + inexperienced;
  int teams = 0;
  while (total > 2) {
    if (experienced > inexperienced && experienced - 2 >= 0 &&
        inexperienced - 1 >= 0) {
      teams++;
      total -= 3;
      experienced -= 2;
      inexperienced -= 1;
    } else if (experienced - 1 >= 0 && inexperienced - 2 >= 0) {
      teams++;
      total -= 3;
      experienced -= 1;
      inexperienced -= 2;
    } else
      break;
  }
  cout << teams;
}
