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