#include <iostream>
using namespace std;

typedef long long ll;
int main(){
  ll n,m;
  cin>>n>>m;
  if(n==1&&m==1) cout<<1<<"\n";
  else if(n==1||m==1) cout<<max(n,m)-2<<"\n";
  else cout<<(n-2)*(m-2)<<"\n";
}
