#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T maxer(T &a, T b) {
  a = max(a, b);
}
template <typename T>
inline T miner(T &a, T b) {
  a = min(a, b);
}
void iOS() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void fin() { freopen("in", "r", stdin); }
void fout() { freopen("out", "w", stdout); }
const int inf = ~0u / 10;
const long long linf = ~0ull / 2;
const int maxn = 220;
int dp[maxn][maxn];
int main() {
  iOS();
  int a, b, ans = 0;
  cin >> a >> b;
  while (a > 0 && b > 0) {
    if (a > b) swap(a, b);
    if (b > 1) ans++;
    a += 1;
    b -= 2;
  }
  cout << ans;
  return 0;
}
