#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    ll n, m;
    cin>>n>>m;
    if(m==1 or n==1)cout<<max(m, n);
    else cout<<(2*(m+n)-4)+(m-2)*(n-2)/2;
    return 0;
}