#include<stdio.h>

int main(){
	//2n + 2m - 4 + (n - 2) * (m - 2) / 2, koristi long long int
	long long int n, m;
	scanf("%lld%lld", &n, &m);
	printf("%lld", 2 * n + 2 * m - 4 + (n - 2) * (m - 2) / 2);
}