#include <bits/stdc++.h>
using namespace std;

int main() {
  long long n, m, rez;
  cin >> n >> m;
  if (n != 1 && m != 1)
    rez = 2 * n + 2 * (m - 2) + (n - 2) * (m - 2) / 2;
  else
    rez = n * m;
  cout << rez << endl;
}