#include <iostream>

using namespace std;

int main()
{
    unsigned long long m,n;
    cin>>n>>m;
     unsigned long long r;
    if((n==1||n==2)||(m==1||m==2)){
     r=n*m;
    }
    else {
            r=((n-2)*(m-2));
    r/=2;
    r+=2*n+2*m-4;
    }
    cout<<r;
    return 0;
}