#include <bits/stdc++.h>
#define MAXN 300010
#define pb push_back
#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pii pair<int, int>

using namespace std;

void solve()
{
    ll n, m;
    cin >> n >> m;
    ll res;
    res = n*2 + (m-2)*2 + (n-2)*(m-2) / 2;
    cout << res << '\n';
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	int tt = 1;
	//cin >> tt;
	while(tt--)
	{
		solve();
	}
	return 0;
}