#include <iostream>

using namespace ::std;

void solve()
{
    long long n, m;
    cin >> n >> m;
    if (n == 1)
    {
        cout << m << '\n';
        return;
    }
    if (m == 1)
    {
        cout << n << '\n';
        return;
    }
    long long res = 2 * (n + m) - 4;
    res += (n - 2) * (m - 2) / 2;
    cout << res << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}