#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    double a, b;
    cin>>a>>b;
    if(a == 1 || b == 1){
        cout<<max(a, b);
    }else{
        cout<<floor(((a-2)*(b-2))/2) + 2*(a + b) - 4;
    }
    return 0;
}