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