#include <bits/stdc++.h>
using namespace std;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const long long int Inf = 1LL << 62;
int main() {
  int a, b;
  cin >> a >> b;
  b += a / 3;
  cout << b / 2 << endl;
  return 0;
}
