#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;
	}
}