#include <bits/stdc++.h>
int main() {
  int a, b, t;
  scanf("%d", &a);
  scanf("%d", &b);
  t = 0;
  while ((a >= 1) && (b >= 1)) {
    t = t + 1;
    if ((a == 1) && (b == 1)) {
      t = 0;
      break;
    } else if (a >= b) {
      a = a - 2;
      b = b + 1;
    } else {
      a = a + 1;
      b = b - 2;
    }
  }
  printf("%d", t);
  return 0;
}
