#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	long long n,m;
	scanf("%lld%lld",&n,&m);
	if(n>=2&&m>=2)
	{
		cout<<(n-2)*(m-2);
		return 0;
	}
	if(n==1&&m==1)
	{
		cout<<1;
		return 0;
	}
	else cout<<max(n*m-2,(long long)0);
	return 0;
}