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