#include <bits/stdc++.h>
using namespace std;
int main() {
  int a1, a2;
  while (~scanf("%d%d", &a1, &a2)) {
    int ans = 0;
    if (a1 == 1 && a2 == 1) {
      printf("0\n");
      continue;
    }
    if (a1 < a2) swap(a1, a2);
    while (1) {
      while (a2 > 2) {
        a2 -= 2;
        ans += 1;
        a1 += 1;
      }
      swap(a1, a2);
      if (a1 <= 2 && a2 <= 2) {
        if (a2 == 2) ans++;
        break;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
