#include <iostream>
using namespace std;
int main()
{
	int N,M,nrSecurity;
	cin>>N>>M;
	if(N==3)
	{
		nrSecurity=N*M-(M-2)/2;
	}
	if(N==M)
	{
		nrSecurity=(N*2)+((M-2)*2)+(((N*M)-((N*2)+((M-2)*2)))/2);
	}

	cout<<nrSecurity;
}