#include <bits/stdc++.h>
using namespace std;
void io() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
const int N = 2e5 + 9;
const long long MOD = 1e9 + 7;
const int INF = 1e9;
int dx[5] = {0, -1, 1, 0, 0};
int dy[5] = {0, 0, 0, -1, 1};
char dc[5] = {'0', 'U', 'D', 'L', 'R'};
int main() {
  int test;
  test = 1;
  while (test--) {
    int x, y;
    cin >> x >> y;
    int ans = 0;
    while (x > 0 && y > 0) {
      if (x > y) swap(x, y);
      if (x < 100) x++;
      y -= 2;
      if (y < 0) break;
      ans++;
    }
    cout << ans;
  }
  return 0;
}
