#include <iostream>

using namespace std;

typedef unsigned long long ull;

int main(){
	int N, M;
	cin>>N>>M;
	ull 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;
	}
}