#include <bits/stdc++.h>

using namespace std;
long long N,M,o,p,k;
int main(){
    cin>>N>>M;
    o=2*N+(2*(M-2));
    p=(N*M)-o;
    k=p/2;
    if(N==1){
        cout<<M<<endl;
    }
    else if(M==1){
        cout<<N<<endl;
    }
    else{
    cout<<k+o<<endl;
    }
}