#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

main ()
{
	unsigned long long int n, m, a, b;
	cin >> n >> m;
	a = m * 2 + n * 2 - 4;
	b = ((m - 2) * (n - 2)) / 2;
	if(a + b == 0){
		cout << 1;
	}
	else{
		cout << a + b;
	}
}