#include<iostream>
using namespace std;
int main()
{
	long long n,m;
	cin>>n>>m;
	if(n<m){long long t=n;n=m;m=t;}
	if(n==1&&m==1)cout<<1<<endl;
	else if(m==1)cout<<n-2<<endl;
	else cout<<max(0ll,(n-2)*(m-2))<<endl;
	return 0;
}
