#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define endl "\n"
#define vi vector <int>
#define vd vector <double>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    ll ivice,sredina,resenje;
    if(n==1 && m==1)
    {
        cout<<1;
        return 0;
    }
    else
    {
        ivice=2*n+2*m-4;
    }
    if(n%2==0 && m%2==0)
    {
        sredina=(n-2)/2*(m-2);
    }
    if(n%2==1 && m%2==1)
    {
        sredina=(m-2)/2*(n-2)/2+1+((m-2)/2+1)*((n-2)/2);
    }
    if(n%2==1 && m%2==0)
    {
        sredina=((m-2)/2)*(n-2);
    }
    if(n%2==0 && m%2==1)
    {
        sredina=(((m-2)/2)*((n-2)/2))+(((m-2)/2+1)*((n-2)/2));
    }
    resenje=ivice+sredina;
    cout<<resenje;
	return 0;
}