#include <bits/stdc++.h>
int main() {
  int a, b, i, j, k, x, y, c = 0;
  scanf("%d%d", &a, &b);
  if (a == 0 || b == 0)
    printf("0");
  else if (a == 1 && b == 1)
    printf("0");
  else {
    while (1) {
      if (a < b) {
        a++;
        b = b - 2;
      } else {
        b++;
        a = a - 2;
      }
      c++;
      if (a == 0 || b == 0) break;
      if (a == 1 && b == 1) break;
    }
    printf("%d", c);
  }
}
