#include <iostream>

using namespace std;
int main() {
	int kolona, red;
	cin >> kolona >> red;
	int brojCuvara = (2 * kolona) + (2 * (red - 2));

	int nkolona = kolona - 2;
	int nred = red - 2;
	brojCuvara += (nkolona * nred) / 2;
	cout << brojCuvara;

	return 0;
}