#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long int n, m;
  cin >> n >> m;
  long long int cnt = 0;
  if (n <= 1 and m <= 1) return (cout << 0, 0);
  while (1) {
    cnt++;
    if (n < m) {
      n++;
      m -= 2;
    } else {
      m++;
      n -= 2;
    }
    if (n <= 0 or m <= 0) break;
  }
  cout << cnt;
}
