#include <iostream>

using namespace std;

int main()
{
    long unsigned int M, N, x, y, a, b;
    cin >> M >> N;
    x = (M - 2) / 2 + (M - 2) % 2;
    y = (M - 2) / 2;
    a = (N - 2) / 2 + (N - 2) % 2;
    b = (N - 2) / 2;
    if(N >= 3 && M >=3)
    {
        cout << 2 * N + 2 * M - 4 +  x * b + y * a;
    }
    else 
    {
        cout << N * M;
    }
}