#include <bits/stdc++.h>

#define ll long long

using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n, m;
    cin >> n >> m;

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