#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, r, t, k;
  scanf("%d %d", &x, &y);
  r = (x + y) / 3;
  if (x > y) {
    t = (y + (y * 2)) / 3;
    k = min(r, t);
  } else {
    t = (x + (x * 2)) / 3;
    k = min(r, t);
  }
  printf("%d\n", k);
  return 0;
}
