#include <bits/stdc++.h>
using namespace std;
int main() {
  int ex, nw, ans = 0;
  scanf("%d %d", &ex, &nw);
  while (ex > 0 && nw > 0) {
    ans++;
    if (ex > nw) {
      ex -= 2;
      nw--;
    } else {
      nw -= 2;
      ex--;
    }
  }
  if (ex < 0 || nw < 0) ans--;
  printf("%d\n", ans);
  return 0;
}
