#include <bits/stdc++.h>
using namespace std;
const int asize = 100005;
const int mod = 1000000007;
long long int mx = -INT_MAX;
long long int mi = INT_MAX;
int main() {
  long long int n, m, ans = 0;
  cin >> n >> m;
  long long int flag = 1;
  while (flag) {
    if (n == 1 && m == 1) {
      flag = 0;
      break;
    }
    if (n <= m) {
      n += 1;
      m -= 2;
    } else if (m < n) {
      m += 1;
      n -= 2;
    }
    ans++;
    if (n == 0 || m == 0) {
      flag = 0;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
