#include <iostream>

using namespace std;

int main()
{
    //      visina| | sirina
    long long int n,m;
    cin >> n >> m;
    long long int zb=(2*m)+2*(n-2);

    if(m%2==0)
    zb+=((m-2)/2)*(n-2);

    else
    {
        if(n%2==0)
            zb+=(m-2)*(n-2)/2;

        else
            zb+=(m-2)*(n-2)/2 + (m-2)/2-1;

    }

    cout << zb << endl;
    return 0;
}