#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    long long int n, m;
    cin >> n >> m;
    cout << 2 * m + 2 * n - 4 + (m - 2) * (n - 2) / 2 << endl;
    return 0;
}