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