#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long m, n;
    cin >> m;
    cin >> n;
    long long res = 0;
    if((m - 2) % 2 != 0)
        res+=2*n + (m-2)*2 + (n-2)*((m-2)/2)+1;
    else
        res+=2*n + (m-2)*2 + (n-2)*((m-2)/2);
    if (n == 3 && m % 2 != 0)
        cout << res-1;
    else
        cout << res;
    
    return 0;
}