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