#include <iostream>
using namespace std;
int main(){
	
	int n, m;
	
	cin >> n >> m;	
	
	int res;
	
	if(n < 3 || m < 3) res = n * m;
	else res = n * 2 + m * 2 - 4 + (n - 2) * (m - 2) / 2;
	
	cout << res;
	
	
	return 0;
}