#include <iostream>

using namespace std;

int main()
{
    long long int N,M;
    cin >> N >> M;
    if (N==1)
    {
        cout << M;
        return 0;
    }
    else if(M==1)
    {
        cout << N;
        return 0;
    }
    else

    {
       long long int S=(N+M)*2-4 +((M-2)*(N-2))/2;
        cout << S;
        return 0;
    }
}