#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m, s;
    cin >> n >> m;
    if (m < 3 || n < 3)
    {
        s = n * m;
    }
    else
    {
        s = ((m - 2) * (n - 2)) / 2 + (n + m - 2) * 2;
    }
    cout << s;
    return 0;
}