#include <iostream>

using namespace std;

int main()
{
    long long n, m, redari;
    cin >> n >> m;

    if (n == 1 && m == 1)
        redari = 1;

    else {
       long long brs, bru;

        if (n == 1 || m == 1){
            redari = max(n, m);
        }
        else {
            brs = n*2 + (m-2)*2;

            long long Pu = (n-2)*(m-2);

            bru = Pu/2;
            redari = brs + bru;
        }

    }

    cout << redari;

    return 0;
}