#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int a, b, c, d, e, count = 0, minus = 0, maxx = 0, minn = 0, x;
  cin >> a >> b;
  while ((a > 0 && b >= 2) || (b > 0 && a >= 2)) {
    c = min(a, b) + 1;
    b = max(a, b) - 2;
    a = c;
    count++;
  }
  cout << count << endl;
}
