#include <iostream>

using namespace std;

int main()
{
    long long n, m;
    cin >> n >> m;
    if(m == 1 && n == 1)
    {
        cout << 1;
    }
    else if(m==1 && n != 1)
    {
        cout << n;
    }
    else if(m != 1 && n ==1)
    {
        cout << m;
    }
    else{
        unsigned long long rez = 2*n + 2*m - 4;
        n-=2;
        m-=2;
        rez += (n*m)/2;
        cout << rez;
    }


}