#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL), cout.precision(15);
  int a, b;
  cin >> a >> b;
  int res = 0;
  while (a > 0 && b > 0 && (a + b > 2)) {
    if (a > b) {
      a -= 2;
      b += 1;
    } else {
      a += 1;
      b -= 2;
    }
    res++;
  }
  cout << res << "\n";
  return 0;
}
