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