#include <bits/stdc++.h>
using namespace std;
int main() {
  int A;
  int P;
  int x;
  int y;
  int z;
  cin >> A;
  cin >> P;
  x = A / 3;
  y = x + P;
  z = y / 2;
  cout << z << endl;
  return 0;
}
