#include <iostream>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    
    
    int sol = 2*(n+m)-4 ;
   
    if(n %2 == 0)
    {
        sol += (n-2)/2 *(m-2);
    }
    else 
    {
        sol += (n-3)/2*(m-2) + ((m-2)-m%2)/2;
    }
    
     if(n == 1 || m == 1){
        sol = n*m;
    }
    cout << sol;
    return 0;
}