#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 30, Mod = 1e9 + 7;
const long long SQ = 330;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long a, b;
  cin >> a >> b;
  long long ans = 0;
  while (a > 0 && b > 0) {
    if (a <= b)
      a++, b -= 2;
    else
      b++, a -= 2;
    if (a < 0 || b < 0) ans--;
    ans++;
  }
  cout << ans;
  return (0);
}
