#include <iostream>

using namespace std;

int main () {
    int N, M, R;
    cin>>N>>M;
    if(N == 1) {
        cout<<M;
    }
    else if(M == 1) {
        cout<<N;
    }
    else {
        R = 2*(N+M)-4 + (N-2)*(M-2)/2;
        cout<<R;
    }
    
    return 0;
}