#include <bits/stdc++.h>
#define FAST {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define FILES {freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);}
#define ll long long
#define ull unsigned long long
#define pqueue priority_queue
#define pb push_back
#define fi first
#define se second
#define ld long double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) (a).begin(), (a).end()
#define mp make_pair 
using namespace std;
// order_of_key -> # less than k
// find_by_order -> k-th element
// pq max element
 
const double eps = 0.00000001;
const int NMAX = 1e6+10;
const ll inf = LLONG_MAX/3;
const ll modi = 998244353;

void solve() {
    ll n,m;
    cin >> n >> m;
    if ( n == 1 || m == 1 ) {
        cout << m*n << endl;
        return;
    }
    ll res = 2 * (n+m) - 4;
    n-=2;
    m-=2;
    res += (m*n)/2;
    cout << res << endl;
}

int main () { 
    FAST
    


    int t=1;

    /*
    cin >> t;
    //*/

    int i = 1;
    while(t--) {
        //cout << "Case #" << i++ << ": " ;
        solve();
    }
}