#include <iostream>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    long long int k, x;
    x = (n - 2) * (m - 2);
    if (n == 1 && m == 1) k = 1;
    else if (x % 2 == 0) k = (n + m - 2) * 2 + x / 2;
    else k = (n + m - 2) * 2 + (x - 1) / 2;
    cout << k;
}