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