#include <iostream>

using namespace std;

int main() {
	long long n, m;
	cin >> n >> m;
	long long edges = (n - 2) * 2 + m * 2;
	m -= 2;
	n -= 2;
	cout << edges + (m / 2) * (n - n / 2) + (n / 2) * (m - m / 2);
}