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