#include <iostream>

using namespace std;


int main(){
    int n,m;
    unsigned long long int br,k;

    cin>>n>>m;
    if (n==1)
        br=m;
    else if (n>=2){
        br=(unsigned long long int)2*m;

        if (n==3){
            if (m%2==0) br=br+m/2+1;
            else br=br+(m+1)/2;
            }
        else if (n==4){
            br=br+m+2;
        }
        else if (n==5){
            if (m%2==0) k=m/2+1;
            else k=(m+1)/2;
            br=br+m+2+k;

        }
        else if (n==6)
            br=br+(m+2)*(n/2-1);
        else if (n%2==0)
            br=br+(unsigned long long int)(m+2)*(n/2-1);
        else if (n%2==1){
            if (m%2==0) k=m/2+1;
            else k=(unsigned long long int)(m+1)/2;
            br=br+k+(unsigned long long int)(m+2)*(n-3)/2;

        }

    }
    cout<<br;

}