#include <iostream>

using namespace std;

int main() {
	int n, m, red;
	
	cin>>n>>m;
	
	int red1=2*n+2*(m-2);
	
	int red2;
	
	if (((n-2)*(m-2))%2==0)
		red2=(n-2)*(m-2)/2;
	
	else 
		red2=((n-2)*(m-2)-1)/2;
		
	red=red1+red2;
	
	cout<<red;
	
	return 0;
}