#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
	int N, M;
	cin >> N >> M;
	int P = N * M;
	int O = (N * M) - (2*N + (2* (M - 2)));
	int O1 = (O / 2) + (2*N + (2 * (M - 2)));
	cout << fixed << O1;
	
	return 0;
}