#include <iostream>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    unsigned long long int N, M;
    cin >> N >> M;
    if (N != 1 && M != 1)
    {
     cout << (M*N-(2*N+2*M-4))/2 + (2*N+2*M-4);
	} else
	{
		cout << (M + N) - 1;
	}

}