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