#include <bits/stdc++.h>

using namespace std;

long long n,m,r;

int main()
{
    scanf("%lld %lld",&n,&m);
    if(n==1 || m==1)
    {
        printf("%lld\n",max(n,m));
        return 0;
    }
    r = n*2+m*2-4;
    if(n<=2 || m<=2)
    {
        printf("%lld\n",r);
        return 0;
    }
    n -= 2;
    m -= 2;
    r += (n*m)/2;
    printf("%lld\n",r);
    return 0;
}