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