#include <bits/stdc++.h>

using namespace std;

int main()
{
    int x, y, br = 0;
    cin >> x >> y;
    if(x < 3 || y < 3)
    {
        br += x * y;
    }
    else
    {
        br += 2 * (x + y) - 4;
        x -= 2;
        y -= 2;
        br += (x * y) / 2;
    }
    cout << br;
    return 0;
}