#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

int main()
{
    long long n, m;
    
    cin >> n >> m;
    
    long long I, U1, U2, K, U;
    
    if(n >2 && m > 2)
    {
        I = (2*m) + 2*(n-2);
        int x, y;
        x = ceil((n-2)/2);
        y = floor((m-2)/2);
        U1 = x * y;
        U2 = (n-2-x)*(m-2-y);
        
        U = (n-2)*(m-2) - (U1 + U2);
        K = I+U;
        
    }
    else
    {
        K = m*n;
    }

    
    cout << K << endl;
    
    return 0;
}