#include <bits/stdc++.h>

using namespace std;
unsigned long long n,m,br,n2,m2;
int main(){
   cin>>n>>m;
   br=0;
   if (m>2 and n>2){
     br=2*m+2*(n-2);
     m2=m-2;
     n2=n-2;
     br+=(n2/2)*m2;
     if (n2%2==1) br+=m2/2;
     cout<<br<<endl;
   }
   else cout<<n*m<<endl;

   return 0;
}