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

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