#include <iostream>

using namespace std;

int main()
{
	long long n,m,rez=0;
	cin >> n >> m;
	if(n<=1 || m<=1)
	{
		cout << n*m << endl;
		return 0;
	}
	rez+=((2*n)+(2*m))-4;
	n-=2;
	m-=2;
	rez+=(n*m)/2;
	cout << rez << endl;
	return 0;
}