#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e9 + 2;
const long long SIZE = 1e5 + 2;
const long long mod = 1e9 + 7;
int a[SIZE];
void solve() {
  int a, b;
  cin >> a >> b;
  int cnt = 0;
  while (a > 1 || b > 1) {
    if (a < b) {
      a++;
      b -= 2;
    } else {
      b++;
      a -= 2;
    }
    cnt++;
    if (a <= 0 || b <= 0) break;
  }
  cout << cnt << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int it = 1;
  for (int i = 1; i <= it; i++) {
    solve();
  };
  return 0;
}
