#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    int redari = floor(((m-2)*(n-2))/2) + 2*m + 2*n - 4;
    if(n == 1 || m == 1)
    {
        cout << max(n,m);
    }
    else
    {
        cout << redari;
    }
    return 0;
}