#include <bits/stdc++.h>
using namespace std;
long long N, M;
int main(){
    cin >> N >> M;
    if(N == 1 or M == 1){
        cout << max(N, M);
    }else{
    cout << (2*(N+M))-4 + ((N-2)*(M-2))/2;
    }
    return 0;
}