#include <iostream>
#include <string>

int main(){
	long long n,m,positives = 0;
	std::cin >> n >> m;

	if(n==1&&m==1)positives = 0;
	else if(n==1||m==1)positives = 2;
	else positives = (m + n - 2) * 2;

	std::cout<<(m*n - positives)<<std::endl;
	return 0;
}
