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

long long n, m, nn, mm, br;

int main()
{
	scanf("%lld %lld", &n, &m);
	if (n==1 or m==1){
		printf("%lld\n", n*m);
		return 0;
	}
	if(n == 2 or m == 2)
	{
		printf("%lld\n", n*m);
		return 0;
	}

	nn = n-2;
	mm = m-2;

	if(n > 2 && m > 2)
	{
		printf("%lld\n", 2*(n + m - 2) + (nn * mm)/2);
		return 0;
	}
}