#include <bits/stdc++.h>
using namespace std;
int dp(int a, int b) {
  if ((a == 1 && b == 1) || b == 0) return 0;
  return dp(max(b + 1, a - 2), min(b + 1, a - 2)) + 1;
}
int main() {
  int n, m;
  cin >> n >> m;
  printf("%d", dp(max(n, m), min(n, m)));
}
