#include "bits/stdc++.h"
#define ll long long
using namespace std;

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

  ll n, m;

  cin >> n >> m;

  ll rez;
  if (n > 2 && m > 2)
    rez = 2 * n + 2 * (m - 2) + ((n - 2) * (m - 2) / 2.0);
  else if (n == 2 && m >= 2)
    rez = 2 * m;
  else if (n >= 2 && m == 2)
    rez = 2 * n;
  else if (n == 1 && m >= 1)
    rez = m;
  else if (n >= 1 && m == 1)
    rez = n;

  cout << rez;

  return 0;
}