#include <bits/stdc++.h>
using namespace std;
int DP[105][105];
int solve(int a, int b) {
  if (a == 0 || b == 0) return 0;
  if (DP[a][b] != -1) return DP[a][b];
  int chargeA = 0;
  int chargeB = 0;
  if (b - 2 >= 0) chargeA += 1 + solve(a + 1, b - 2);
  if (a - 2 >= 0) chargeB += 1 + solve(a - 2, b + 1);
  DP[a][b] = max(chargeA, chargeB);
  return max(chargeA, chargeB);
}
int main() {
  memset(DP, -1, sizeof(DP));
  int a, b;
  cin >> a >> b;
  cout << solve(a, b);
  return 0;
}
