#include<iostream>
using namespace std;
long long m, n;
int main ()
{
    cin>>n>>m;
        if((n*m)>1 and m!=1 and n!=1)
        cout<<((2*(m+n))-4)+((m-2)*(n-2))/2<<endl;
        else if(n==1 or m==1)
            cout<<max(m, n)<<endl;
    return 0;
}