#include <iostream>

using namespace std;

int main()
{
    int a,b,br=0;
    cin>>a>>b;
    int tribine[a][b]={0};
    for (int i=0; i<a; i++){
        for (int j=0; j<b; j++){
            if (i==0 || j==0 || i==a-1 || j==b-1){
                tribine[i][j]=1;
                br++;
            }
            else if (tribine[i-1][j]==0 || tribine[i][j-1]==0){
                tribine[i][j]=1;
                br++;
            }
        }
    }
    cout<<br;
}