 #include <bits/stdc++.h>
using namespace std;
 
int main() {
 long long a,b;
  cin>>a>>b;
  if(a==1 ||b==1){
    if(a+b>=3){
      cout<<a+b-3<<endl;
    }
    else if(a+b==2){
      cout<<1<<endl;
    }
  }
  
    else {
      cout<<a*b-2*a-2*b+4<<endl;
    }
}