#include <bits/stdc++.h>
using namespace std;
int main() {
  bool testing = false;
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (testing) {
    freopen("test.txt", "rt", stdin);
  }
  int a, b, big, count = 0;
  ;
  cin >> a >> b;
  while (a > 0 && b > 0) {
    if (a > b) {
      big = a;
    } else {
      big = b;
    }
    if (big == a) {
      a = a - 2;
      b = b + 1;
    } else {
      b = b - 2;
      a = a + 1;
    }
    if (a >= 0 && b >= 0) {
      ++count;
    }
  }
  cout << count << endl;
}
