#include <bits/stdc++.h>
using namespace std;
long long debug = 0.0;
long long debug_test = 0;
long long _t = 0;
typedef unsigned long long ulli;
typedef vector<vector<long long>> matrix;
template <class T>
long long sz(T &x) {
  return (long long)x.size();
}
template <class T>
void show(T first) {
  if (debug and (debug_test == 0 or _t == debug_test))
    cerr << " " << first << "\n";
}
template <class T>
bool sort_fun(T a, T b) {
  return a > b;
}
template <class T, class U>
bool found(T t, U u) {
  if (t.find(u) == t.end()) return false;
  return true;
}
template <class T, class... Args>
void show(T first, Args... args) {
  if (debug and (debug_test == 0 or _t == debug_test)) cerr << " " << first;
  show(args...);
}
template <class T>
void _p(T x) {
  long long i = 0;
  for (auto a : x) {
    if (debug and (debug_test == 0 or _t == debug_test))
      cerr << " " << a << ",";
    if (i++ > 20) break;
  }
}
template <class T, class U>
ostream &operator<<(ostream &o, pair<T, U> &x) {
  return o << "(" << x.first << "," << x.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, vector<T> &x) {
  if (debug and (debug_test == 0 or _t == debug_test))
    cerr << " "
         << "[";
  _p(x);
  if (debug and (debug_test == 0 or _t == debug_test))
    cerr << " "
         << "] ";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, set<T> &x) {
  if (debug and (debug_test == 0 or _t == debug_test))
    cerr << " "
         << "{";
  _p(x);
  if (debug and (debug_test == 0 or _t == debug_test))
    cerr << " "
         << "} ";
  return os;
}
const long long mod = 1e9 + 7, inf = LLONG_MAX, none = inf / 2 - 9;
struct Desc {
  bool operator()(long long a, long long b) { return a > b; }
} desc;
void solve() {
  long long a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  if (b > a) {
    if (b >= 2 * a) {
      cout << a << "\n";
      cout.flush();
    } else {
      long long more = b - a;
      long long left = a - more;
      long long ans = (left / 3) * 2 + more;
      long long rem = left % 3;
      if (rem == 2) ans++;
      cout << ans << "\n";
      cout.flush();
    }
  }
  if (a == b) {
    long long ans = a / 3;
    ans *= 2;
    if (a % 3 == 2) ans++;
    cout << ans << "\n";
    cout.flush();
  }
}
void preprocess() {}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  std::cout << std::fixed;
  std::cout.precision(7);
  preprocess();
  long long test = 1;
  for (long long t = 1; t <= test; t++) _t = t, solve();
}
