#include <bits/stdc++.h>
using namespace std;
int dp[201][201];
int main() {
  int a, b;
  cin >> a >> b;
  for (int len = 1; len <= a + b; len++) {
    for (int i = 1; i < len; i++) {
      int j = len - i;
      if (i >= 2 && j >= 2) {
        dp[i][j] = max(dp[i][j], max(dp[i - 2][j + 1], dp[i + 1][j - 2]) + 1);
      } else if (i >= 2) {
        dp[i][j] = max(dp[i][j], dp[i - 2][j + 1] + 1);
      } else if (j >= 2) {
        dp[i][j] = max(dp[i][j], dp[i + 1][j - 2] + 1);
      }
    }
  }
  cout << dp[a][b] << endl;
}
