#include <iostream>
using namespace std;

int main() {
    long long n;
    long long m;
    cin >> n;
    cin >> m;
    long long p = 0;
    long long u = n*m;
    u = u - (n*2) - ((m-2)*2);
    p = p + (n*2) + ((m-2)*2);
    p = p + u/2;
    if (n == 1 || m == 1){
        cout << n*m << endl;
    }else{
    cout << p << endl;
    }
}