#include <cstdio>
#include <algorithm>

using namespace std;

int m,n;

int main()
{
	scanf("%d%d",&n,&m);
	if (m==1) swap(n,m);
	if (n==1) if (m==1) printf("%d",1); else printf("%d",m-2);
	else printf("%lld",1LL*(n-2)*(m-2));
}