#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  ll n, m;
  cin >> n >> m;

  ll b = (n == 1 || m == 1) ? (n * m) : (2 * (n) + 2 * (m)-4);
  ll i = max(0ll, (((n - 2) * (m - 2)) / 2));

  cout << (b + i) << "\n";
}