#include <bits/stdc++.h>
int main() {
  int m, n, x = 0, y;
  scanf("%d%d", &m, &n);
  if (m == 1 && n == 1) {
    printf("0\n");
    return 0;
  }
B:
  while (m >= n) {
    m = m - 2;
    n = n + 1;
    x++;
    if (m < n && m > 0 && n > 0) {
      goto A;
    }
    if (m <= 0) {
      printf("%d\n", x);
      return 0;
    }
  }
A:
  while (n >= m) {
    n = n - 2;
    m = m + 1;
    x++;
    if (n < m && m > 0 && n > 0) {
      goto B;
    }
    if (n <= 0) {
      printf("%d\n", x);
      return 0;
    }
  }
}
