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