#include <bits/stdc++.h>
using namespace std;
int ar[200][200];
void initialise() {
  for (int i = 0; i < 200; i++) {
    for (int j = 0; j < 200; j++) ar[i][j] = -1;
  }
}
int charge(int x, int y) {
  if (y <= 0 || x <= 0)
    return 1;
  else if (ar[x][y] != -1)
    return ar[x][y];
  else {
    ar[x][y] = 1 + max(charge(x + 1, y - 2), charge(x - 2, y + 1));
    return ar[x][y];
  }
}
int main() {
  initialise();
  int x, y;
  cin >> x >> y;
  if (x == 1 && y == 1)
    cout << 0;
  else
    cout << charge(x, y) - 1;
  return 0;
}
