#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

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

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