#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (cin >> n >> m) {
    int ans = 0;
    while (n > 0 && m > 0 && n + m >= 3) {
      if (n > m) {
        ++ans;
        n -= 2, --m;
      } else {
        ++ans;
        --n, m -= 2;
      }
    }
    cout << ans << endl;
  }
}
