#include <bits/stdc++.h>
using namespace std;

int main(int argc, char **argv){
	long long n, m;
	cin >> n >> m;
	if(n == 1 || m == 1) {
		cout << max(n, m) << endl;
		return 0;
	}
	long long ans = 2 * (n + m) - 4 + (n - 2) * (m - 2) / 2;
	cout << ans << endl;
	return 0;
}