#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, ans = 0;
  scanf("%d%d", &a, &b);
  while (1) {
    if (a == 0 || b == 0 || (a == 1 && b == 1))
      break;
    else {
      if (a > b) {
        a -= 2;
        b++;
      } else {
        b -= 2;
        a++;
      }
      ans++;
    }
  }
  printf("%d\n", ans);
}
