#include <stdio.h>

main(){
	long long unsigned n,m,c=0;
	scanf("%llu%llu", &n,&m);
	if(n == 1 || m == 1) c+=n*m;
	else if(n==0 || m==0) printf("0");
	else c+=2*m+2*(n-2)+((m-2)*(n-2))/2;
	printf("%llu", c);
}