#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll n, m, rez = 0;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    if(n == 1 || m == 1)
    {
        cout << m * n;
    }
    else
    {
        rez = 2 * (m - 1) + 2 * (n - 1);
        rez += (m - 2) * (n - 2) / 2;
        cout << rez;
    }
    return 0;
}