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