#include <bits/stdc++.h>
using namespace std;
int max(long long int a, long long int b, long long int c) {
  long long int temp;
  if (a > b)
    temp = a;
  else
    temp = b;
  if (temp > c)
    return temp;
  else
    return c;
}
int main() {
  long long int n, m;
  cin >> n >> m;
  if (m >= 2 * n)
    cout << n;
  else if (n >= 2 * m)
    cout << m;
  else {
    cout << max(n / 2, m / 2, (m + n) / 3);
  }
}
