#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, a, b, count = 0;
  cin >> a >> b;
  if (b > a) swap(a, b);
  while (a >= 1 && b >= 1 && a + b > 2) {
    if (b > a) swap(a, b);
    a -= 2;
    count++;
    b++;
  }
  cout << count << endl;
}
