#include<bits/stdc++.h>
using namespace std;
long long n,m,br,br1;
int main(){
    cin>>n>>m;
    if(n==1){
        cout<<m<<endl;
    }
    else if(m==1){
        cout<<n<<endl;
    }
    else{
    br=n*2+(m-2)*2;
    br1=((n-2)*(m-2))/2;
    cout<<br+br1<<endl;
    }
return 0;
}