#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
    ll n,m;
    cin>>n>>m;
	ll ans=n*m;
	if (n>m) swap(n,m);
	if (n==1){
		ans=m-2;
	}else{
		ans-=n*2+m*2-4;
	}
	if (ans<0) ans=0;
	if (n==1&&m==1) ans=1;
	cout<<ans;
}