#include <bits/stdc++.h>
using namespace std;
int main(){
	long long n, m;
	scanf("%lld %lld", &n, &m);
	if(n == 1 || m == 1){
		printf("%lld", n * m);
		return 0;
	}
	printf("%lld",((n - 2) * (m - 2)) / 2 + 2 * n + 2 * m - 4);
	return 0;
}