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

int main(){

    long long n, m;
    cin>>n>>m;
    long long res;
    long long border;
    long long inside;

    if(n != 1 && m != 1){

        border = 2*m + 2*n - 4;
        if(n%2 == 0){
            inside = (m-2)*(n-2)/2;
        }
        if(m%2 == 0){
            inside = (m-2)*(n-2)/2;
        }
        if(n%2 != 0 && m%2 != 0){
            inside = ((m-2)*(n-2)-1)/2;
        }
        res = border + inside;
    }
    if(n == 1 && m != 1){
        res = m;
    }
    if(n != 1 && m == 1){
        res = n;
    }
    if(n == 1 && m == 1){
        res = 1;
    }

    cout<<res<<endl;
}