using namespace std;
#include <iostream>

int main()
{
    long long n, m;
    cin >> n >> m;

    long long a = 0;
    if (n < 3 || m < 3)
    {
        cout << n * m;
    }
    else 
    {
        a += (2 * n + 2 * m - 4) + (n - 2) * (m - 2) / 2;
        cout << a;
    }
}