#include <bits/stdc++.h>
int dx[] = {0, 0, 1, 1};
int dy[] = {1, 1, 0, 0};
using namespace std;
vector<int> v, v2, v3;
vector<int>::iterator it1, it2;
int main() {
  int a, b, ans = 0, ma, mb;
  scanf("%d %d", &a, &b);
  ma = min(a, b);
  mb = max(a, b);
  ans += (a + b) / 3;
  if (ans <= ma) {
    printf("%d\n", ans);
    return 0;
  } else {
    ans = 0;
    int d = mb / 2;
    if (ma > d) {
      mb -= d * 2;
      ans += d;
      ma -= d;
    } else {
      printf("%d\n", ma);
      return 0;
    }
    d = ma / 2;
    if (mb > d) {
      printf("%d\n", d + ans);
      return 0;
    } else {
      printf("%d\n", ans + mb);
      return 0;
    }
  }
}
