#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long N,M;
    cin >> N >> M;
    if(N == 1 || M == 1)
    {
        cout << N*M << endl;
        return 0;
    }
    cout << 2*(N+M) - 4 + ((N-2)*(M-2)/2);
    return 0;
}