#include <bits/stdc++.h>
using namespace std;
long long N,M,x;
int main(){
  cin>>N>>M;
  if(N==1){cout<<M<<"\n";return 0;}
  if(M==1){cout<<N<<"\n";return 0;}
  x=(N*2+M*2)-4;
  N-=2;
  M-=2;
  x+=N*M/2;
    cout<<x<<"\n";

 return 0;
}