#include <bits/stdc++.h>
using namespace std;
long long N,M,rez,centr,okvir;
int main(){
  cin>>N>>M;
  if(M<=2 or N<=2){
    okvir=M*N;
    rez=okvir;
  }
  else{
    centr=((M-2)*(N-2))/2;
    okvir=2*(M+N);
      rez = centr+okvir-4;
  }
  cout<<rez<<endl;
  return 0;
}