#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int maxn = 2e5 + 5;
const double pi = acos(-1);
const double EPS = 1e-9;
const int mod = 1e9 + 7;
int dr[4] = {1, -1, 0, 0};
int dc[4] = {0, 0, 1, -1};
void myMain() {
  int a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  int cnt = 0;
  while (a > 0 && b > 0 && !(a == 1 && b == 1)) {
    if (a < b) {
      a++;
      b -= 2;
    } else {
      a -= 2;
      b++;
    }
    cnt++;
  }
  cout << cnt << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  int t = 1;
  while (t--) {
    myMain();
  }
}
