#include <bits/stdc++.h>
#define en '\n'
#define MAXN 200005

using namespace std;

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

    int n,m; cin >> n >> m;
    if(n<=2 || m<=2) {cout<<n*m<<en;return 0;}
    cout << 2*(n+m) - 4 + ((n-2)*(m-2))/2 << en;
}