#include <iostream>
#include <cmath>

void OptimizeIO() {
    std::ios_base::sync_with_stdio(false);
    std::cerr.tie(0);
    std::cout.tie(0);
    std::cin.tie(0);
}

int Outer(int rows, int columns) {
    return rows + columns - 1 + (rows > 1) * (columns - 1) + (columns > 1) * (rows - 1) - ((rows - 1) * (columns - 1) > 0);
}
int Inner(int rows, int columns) {
    return std::max(0, (rows - 2) * (columns - 2) / 2);
}
int Guards(int rows, int columns) {
    return Inner(rows, columns) + Outer(rows, columns);
}

int main() {
    using namespace std;
    OptimizeIO();
    int m;
    int n;
    cin >> m >> n;
    cout << Guards(m, n) << endl;
    return 0;
}