#include <iostream>
using namespace std;

int main() {
	unsigned long long a, b, zbir=0, y=0;
	cin >> a;
	cin >> b;
	if(a == 1 or b ==1){
		cout << a*b;
		return 0;
	}
	zbir+=2*a+2*b-4;
	if(b % 2 !=0){
		if(a % 2 ==0){
			zbir+=(b-2)*(a-2)/2;
		}
		else {
			zbir+=((b-2)*(a-2)-1)/2;
		}
	
	}
	
	else {
			zbir+=((b-2)*(a-2))/2;
		}
	
	cout <<zbir;
	// your code goes here
	return 0;
}