// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var tmp = line[0].split(" ");
	var N = Number(tmp[0]);
	var M = Number(tmp[1]);
	var ans = Math.abs((M-2)*(N-2));
	if(ans > 1000000000000000){
		var Ntop = Math.floor(N/10000);
		var Nbottom = N%10000;
		var Mtop = Math.floor(M/10000);
		var Mbottom = M%10000;
		var ans1 = Ntop*Mtop;
		var ans2 = Ntop*Math.abs(Mbottom-2)+Mtop*Math.abs(Nbottom-2);
		var ans3 = Math.abs((Nbottom-2)*(Mbottom-2));
		var ansbottom = (ans2 + Math.floor(ans3/10000)) + "";
		ansbottom += ans3%10000;
		var ans = (ans1 + Math.floor(Number(ansbottom)/100000000)) + "";
		ans += ansbottom%100000000;
	}
	console.log(ans);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
