#include <fstream>
#include <iostream>

using namespace std;

int main()
{
	ifstream fin("input.txt");
	ofstream fout("output.txt");

	int a,b;
	fin>>a>>b;
	if (a>b) {int t=a; a=b; b=t;}
	int max=0;
	if (a<b/3) max=a; else max=b/3;
	if (a/2>max) max=a/2;
	fout<<max;
	fin.close();
	fout.close();
	return 0;
}

