#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long MOD = 1000000007;
const long long inf = 1e18;
const long long MOD_1 = 998244353;
inline long long gcd(long long a, long long b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
inline void take_input(long long A[], long long n) {
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
  }
}
inline void show(long long *A, long long n) {
  for (long long i = 0; i < n; i++) {
    cout << A[i] << " ";
  }
  cout << '\n';
}
inline long long countDivisibles(long long a, long long b, long long c) {
  if (a % c == 0) {
    return (b / c - a / c + 1);
  }
  return (b / c - a / c);
}
inline bool sortbysec(const pair<long long, long long> &a,
                      const pair<long long, long long> &b) {
  return (a.second < b.second);
}
inline bool sortbysecdesc(const pair<long long, long long> &a,
                          const pair<long long, long long> &b) {
  return (a.second > b.second);
}
inline void swap(long long &a, long long &b) {
  long long temp = a;
  a = b;
  b = temp;
}
inline void initialise(long long A[], long long n, long long k) {
  for (long long i = 0; i < n; i++) {
    A[i] = k;
  }
}
inline long long modulo(long long a, long long b) { return (b + (a % b)) % b; }
template <typename T>
void show_vect(vector<T> v) {
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << '\n';
}
template <typename T>
void vect_input(vector<T> &v, long long n) {
  for (long long i = 0; i < n; i++) {
    T input;
    cin >> input;
    v.push_back(input);
  }
}
void p_g_t() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int32_t main() {
  p_g_t();
  long long a, b;
  cin >> a >> b;
  long long minu = 0;
  while (true) {
    if (a < 1 || b < 1 || (a == 1 && b == 1)) break;
    if (a == min(a, b)) {
      a++;
      b -= 2;
    } else {
      b++;
      a -= 2;
    }
    minu++;
  }
  cout << minu;
  return 0;
}
