#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a, b;
  cin >> a >> b;
  if (a > 2 * b)
    cout << b << endl;
  else if (b > 2 * a)
    cout << a << endl;
  else
    cout << (a + b) / 3 << endl;
}
