#include <bits/stdc++.h>

using namespace std;

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

    if(n <= 2 || m <= 2)
    {
        cout << m*n << endl;
    }
    else
    {
        cout << 2*(n + m) - 4 + floor((n-2)*(m-2)/2) << endl;
    }
    return 0;
}