#include <bits/stdc++.h>
using namespace std;
int main() {
  int a1, b1, c = 0;
  cin >> a1 >> b1;
  bool chrg[3];
  int a = max(a1, b1), b = min(a1, b1);
  if ((a - 2) < 0 && (b - 2) < 0) {
    a = 0;
    b = 0;
  }
  while (a != 0 && b != 0) {
    c++;
    if (a - 2 > 0) {
      a -= 2;
      b++;
    } else {
      if (b - 2 > 0) {
        b -= 2;
        a++;
      } else {
        break;
      }
    }
  }
  cout << c;
  return 0;
}
