#include <iostream>
using namespace std;
typedef unsigned long long ull;
int main()
{
    ull n, m;
    cin >> n >> m;
    ull chad;
    chad = 2 * n + 2 * m - 4 + ((n - 2) * (m - 2)) / 2;
    if (n == 1 || m == 1)
    {
        chad = n * m;
    }
    
    cout << chad;
}