#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	
	long long n, m;
	cin >> n >> m;
	
	int s = 0;
	
	if(n < 3 || m < 3)
		s = n*m;
		
	else
	{
		s = 2*m + 2*(n-2) + ((n-2)*(m-2))/2;
	}
	
	cout << s;
	return 0;
}