#include <bits/stdc++.h>

using namespace std;

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