#include<bits/stdc++.h>

using namespace std;

int main(){
    long long n, m;
    cin >> n >> m;
    if(n == 1 || m == 1){
        cout << n*m << "\n";
        return 0;
    }
    long long x = (n+m)*2 - 4 + ((n-2)*(m-2))/2;
    cout << x << "\n";
    return 0;
}