#include <iostream>

using namespace std;

int main()
{
    long long int n,m;
    cin >>n >>m;
    long long int frame = n*m - ((n-2)*(m-2));
    long long int checkerboard = ((n-2)*(m-2))/2;
    if((n == 1 && m== 1) || (n == 2 && m == 2))
        cout << n*m;
    else{

        if((n == 1 && m > 1) || (n > 1 && m == 1)){
            cout << n*m;
        }
         else{

             if(n==3 && m < 5){
                cout << frame + checkerboard;
                }
                else{
                    if(n == 3 && m > 4){
                        cout << frame + checkerboard; //(m-2)/2;
                    }
                    else{
                        if(n > 3 && m > 3){
                            cout << frame + checkerboard;
                           }
                            else{
                                 cout << frame + checkerboard;
                            }
                    }
                    //cout << checkerboard+frame;
                }

            }
    }


    return 0;
}