#include <bits/stdc++.h>
using namespace std;
const long long M = 5e5 + 100;
int main() {
  ios::sync_with_stdio(false);
  long long a1, a2, ct = 0;
  cin >> a1 >> a2;
  while (true) {
    if (a1 > a2) swap(a1, a2);
    if (a1 == 1 && a2 == 1) return cout << ct, 0;
    a1++;
    a2 -= 2;
    ct++;
    if (a1 <= 0 || a2 <= 0) return cout << ct, 0;
  }
  return 0;
}
