#include <iostream>

using namespace std;

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