#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll int N, M;
    cin >> N >> M;
    ll int br = 2 * (N + M) - 4 + (M - 2) * (N - 2) / 2;
    cout << br << endl;

}