#include<bits/stdc++.h>
using namespace std;
int main(){
	int N, M;
	cin >> N >> M;
	int broj_redara;
	
	if(N == 1 and M == 1)
		broj_redara = 1;
	else
	    broj_redara = 2*(N+M-2) + ((N-2)*(M-2)/2);
	
	cout << broj_redara;
	
	return 0;
}