#include <iostream>
using namespace std;

int main()
{
	long long n, m;
	cin>>n>>m;
	long long redari=2*n+2*m-4;
	if(m%2==0) redari+=((m-2)/2)*(n-2);
	else if(n%2==0) redari+=((n-2)*(m-2))/2;
	else redari+=((n-3)*(m-2))/2+(m-3)/2;
	cout<<redari<<endl;
}