#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6;
const int MOD = 1e9 + 7;
int dp[101][101];
int solve(int A, int B, int t) {
  if (A <= 0 || B <= 0) return t;
  if (A == 1 && B == 1) return t;
  if (dp[A][B] != -1) return dp[A][B];
  dp[A][B] = max(solve(A - 2, B + 1, t + 1), solve(A + 1, B - 2, t + 1));
  return dp[A][B];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int A, B;
  cin >> A >> B;
  memset(dp, -1, sizeof dp);
  cout << solve(A, B, 0);
  return 0;
}
