#include <iostream>

using namespace std;

int main()
{
    long long int n;
    long long int m;
    long long int br = 0;
    cin >> n >> m;
    cout << 2 * m + 2 * n - 4 + (m - 2) * (n - 2) / 2;

    return 0;
}