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

int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	long long n, m, dodatak;
	
	cin >> n >> m;
	
	if (n < 3 || m < 3) dodatak = 0;
	else dodatak = (n-2)*(m-2)/2;
	
	cout << n * 2 + m * 2 - 4 + dodatak;
	
	return 0;
}