#include <iostream>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m, rez;
    cin>>n>>m;

    rez = ((n<3)||(m<3)) ? ( m*n ) : ( 2*(n+m)-4 + (n-2)*(m-2)/2 );
    cout << rez;
    
    return 0;
}