#include <bits/stdc++.h>
int num = 0;
void dian(int a, int b) {
  num++;
  if (a * b == 2 || a == 2 && b == 2) {
    return;
  }
  if (a == 1 && b == 1) {
    num--;
    return;
  }
  dian(a > b ? (a - 2) : (a + 1), a > b ? (b + 1) : (b - 2));
}
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  dian(a, b);
  printf("%d", num);
  return 0;
}
