#include <bits/stdc++.h>
using namespace std;
int ma(int a, int b) { return a >= b ? a : b; }
int mi(int a, int b) { return a >= b ? b : a; }
int main() {
  int a[10000], b[10000], i, j;
  while (scanf("%d%d", &a[0], &b[0]) != EOF) {
    int t = 0, k;
    if (a[0] < 2 && b[0] < 2) {
      cout << 0 << endl;
      continue;
    }
    if (a[0] < 3 && b[0] < 3) {
      cout << 1 << endl;
      continue;
    }
    for (i = 0; a[i] >= 3 || b[i] >= 3; i++) {
      k = (ma(a[i], b[i]) - 1) / 2;
      t = t + k;
      a[i + 1] = mi(a[i], b[i]) + k;
      b[i + 1] = ma(a[i], b[i]) - 2 * k;
    }
    cout << t + 1 << endl;
  }
}
