#include <iostream>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    cout << (M * N - (2 * N + 2 * M - 4)) / 2 + (2 * N + 2 * M - 4);
}