import std.stdio;
import std.algorithm;
import std.conv;
import std.string;
import std.math;

void main(string[] args)
{
	auto n = split(strip(readln));
	auto a = to!long(n[0]);
	auto b = to!long(n[1]);
	long count;
	if (a == 1 && b == 1)
	{
		writeln(0);

		return;
	}
	while(a >= 1 && b >= 1)
	{
		if (a < b)
		{
			a++;
			b -= 2;
		}
		else
		{
			b++;
			a -= 2;
		}
		count++;
// 		writeln(a, "\t", b);
	}
	writeln(count);
}