#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main(){
    cin>>a>>b;
    if(a==1){
        cout<<b<<endl;
    }
    else if(b==1){
        cout<<a<<endl;
    }
    else if(a!=1 or b!=1){
    cout<<2*b+2*(a-2)+((b-2)*(a-2))/2<<endl;
    }



}