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