#include <iostream>

using namespace std;

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

    if((n<=3 && m <=3)&&(n*m != 9))
        cout << n*m;
    else if(n == 3 && m == 3)
        cout << 8;
    else
    {
        r += m*2;
        r += (n-2)*2;
        long long int ns = n-2;
        long long int ms = m-2;
        if(m%2 == 0)
        {
            long long int b = ms/2;
            r += ns*b;
        }
        else
        {
            long long int a = ns/2;
            long long int b = ms/2;
            if(n%2 == 0)
            {
                r += a*b;
                r += a*(b+1);
            }
            else
            {
                r += (a+1)*b;
                r += a*(b+1);
            }

        }
        cout << r;
    }
}