#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, t, days = 0;
  cin >> a >> b;
  if (min(a, b) == max(a, b) && min(a, b) == 1) {
    cout << 0;
    return 0;
  }
  while ((t = min(a, b)) > 0) {
    if (t == a) {
      a++;
      b -= 2;
    } else if (t == b) {
      b++;
      a -= 2;
    }
    days++;
  }
  cout << days;
}
