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