#include<bits/stdc++.h>

using namespace std;

int main(){
	long long n,m,brojac=0;
	cin>>n>>m;
	brojac=2*(n+m)-4;
	n=n-2;
	m=m-2;
	if(n%2==0){
		brojac+=m*(n/2);
	}
	else{
		brojac+=m*(n-1)/2+m/2;
	}
	cout<<brojac;
	return 0;
}