#include <iostream>

using namespace std;

int main()
{

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  long long m, n;

  long long u;

  cin >> m >> n;

  u = ( ( (m - 2) * (n  - 2) ) / 2 ) + 2 * (m + n) - 4;

  cout << u << '\n';
   
}