#include <bits/stdc++.h>
#define ull unsigned long long
#define pii pair<int, int>
using namespace std;


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

    ull n, m;
    cin>>n>>m;

    if(n==1 || m==1)
    {
        cout<<max(n, m)<<"\n";
    }else{
        ull ans = 2*(n+m)-4;
        ull v2 = (m-2)/2 * (n-2);
        ans += v2;
        if(m%2==1)
        {
            ans+= (n-2)/2;
        }
        cout<<ans;

    }



    return 0;
}