#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long n, m;
    cin >> n >> m;

    if (n < 3 || m < 3)
        cout << n * m;

    else
        cout << 2 * (n + m - 2) + (n - 2) * (m - 2) / 2;
    
    return 0;
}