#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  while (scanf("%d %d", &a, &b) != EOF) {
    int tm = 0;
    int flag;
    if (a <= b) {
      flag = 1;
    } else {
      flag = 2;
    }
    while (a > 0 && b > 0) {
      if (flag == 1) {
        if (b >= 2) {
          b -= 2;
          a += 1;
          tm++;
        } else {
          break;
        }
        if (b == 2 && a > 2) {
          flag = 2;
        } else if (b == 1 && a >= 2) {
          flag = 2;
        }
      } else {
        if (a >= 2) {
          a -= 2;
          b += 1;
          tm++;
        } else {
          break;
        }
        if (a == 2 && b > 2) {
          flag = 1;
        } else if (a == 1 && b >= 2) {
          flag = 1;
        }
      }
    }
    printf("%d\n", tm);
  }
  return 0;
}
