#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define LPRINT(a, b) for (auto&(a) : (b))
#define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define lij(i,a,b) for (int (i) = (a); (i) <= (b); (i)++)

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

int n,m;
cin>>n>>m;
if(n==1 || m==1 || n==2 || m==2){
	cout<<n*m;
}
else{
	ll res = 2*(n+m)-4 + (n-2)*(m-2)/2;
	cout<<res;
}
return 0;
}