#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 0;
  cin >> n >> m;
  while (n && m && max(n, m) > 1) {
    if (n < m) {
      n++;
      m -= 2;
    } else {
      m++;
      n -= 2;
    }
    ans++;
  }
  cout << ans;
}
