import std.stdio;
import std.string;
import std.conv;
 
void main()
{
	auto input = split( readln() );
	long N = to!long(input[0]), M = to!long(input[1]);
	
	if (N >= 2 && M >= 2) { writeln( (N-2) * (M-2) ); }
	else if ( N == 1 && M >= 2 ) { writeln( M-2 ); }
	else if ( M == 1 && N >= 2 ) { writeln( N-2 ); }
	else if ( N == 1 && M == 1 ) { writeln(1); }
	
}