#include <stdio.h>
	main()
	{
		long long unsigned N,M;
		scanf("%d%d",&N,&M);
		if(N==1 || M==1){
			if(N>=M)
			printf("%lu",N);
			else
			printf("%lu",M);
		}
		else {
		unsigned long long r=2*N+2*(M-2)+((M-2)*(N-2))/2;
		printf("%llu",r);
	}
	}