#include <bits/stdc++.h>

using namespace std;

long long int n,m;
long long int redari = 0;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m;

    if(n == 1){
        cout << m << endl;
        return 0;
    }

    if(m == 1){
        cout << n << endl;
    }

    redari += 2 * n + 2 * m - 4;

    redari += (n - 2) * (m - 2) / 2;

    cout << redari << endl;

    return 0;
}