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