#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	ios_base::sync_with_stdio(false);
	
	unsigned long long int n,m;
	cin >>n>>m;
	if(n==1 && m==1)
	{
		cout <<"1\n";
	}
	else if(n<2 || m<2)
	{
		cout <<n*m<<"\n";
	}
	else
	{
		cout <<n*2+m*2-4+(n-2)*(m-2)/2<<"\n";
	}
	return 0;
}