#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  long long a, b;
  cin >> a >> b;
  if (a > b) {
    swap(a, b);
  }
  if (a * 2 <= b) {
    cout << a << endl;
    return 0;
  }
  long long posibbleTeams = a;
  long long finalNumber = 0;
  posibbleTeams -= b - a;
  finalNumber += b - a;
  while (posibbleTeams > 0) {
    posibbleTeams -= 1;
    if (posibbleTeams > 0) {
      posibbleTeams--;
      finalNumber++;
    }
    if (posibbleTeams > 0) {
      posibbleTeams--;
      finalNumber++;
    }
  }
  cout << finalNumber << endl;
  return 0;
}
