#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
void fast_io() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
void solve();
int main() {
  fast_io();
  solve();
  return 0;
}
int a, b;
vector<vector<pair<int, int>>> dp;
void solve() {
  cin >> a >> b;
  int answer = 0;
  while (a > 0 && b > 0) {
    if (a < b) {
      b -= 2;
      a++;
    } else {
      a -= 2;
      b++;
    }
    if (a < 0 || b < 0) break;
    answer++;
  }
  cout << answer;
}
