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