#include <iostream>

using namespace std;

typedef long long ll;

int main(){
	int N, M;
	cin>>N>>M;
	ll pomoc=N*M-2*N-2*(M-2);
	if(N==1 and M!=1){
		cout << m;
	}if(M==1 and N!=1){
		cout << n;
	}if(N==1 and M==1){
		cout << 1;
	}if(N!=1 and M!=1){
		cout << 2*n+2*(m-2)+pomoc/2;
	}
}