#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
FILE *in = stdin, *out = stdout;
int n, m;
void input() { fscanf(in, "%d", &n), fscanf(in, "%d", &m); }
void pro() {
  int ans = 2;
  if (n == 1 && m == 1) {
    fprintf(out, "2");
    return;
  }
  if (n > m) swap(n, m);
  if (n == 1) {
    if (m == 2)
      ans += 2;
    else if (m == 3)
      ans += 4;
    else
      ans = 10;
  } else if (n == 2) {
    if (m == 2)
      ans += 2;
    else if (m == 3)
      ans += 4;
    else
      ans = 10;
    ans += 2;
  } else if (n == 3) {
    if (m == 2)
      ans += 2;
    else if (m == 3)
      ans += 4;
    else
      ans = 10;
    ans += 4;
  } else if (n == 4) {
    if (m == 2)
      ans += 2;
    else if (m == 3)
      ans += 4;
    else
      ans = 10;
    ans += 8;
  }
  fprintf(out, "%d", ans);
}
int main() {
  input();
  pro();
  return 0;
}
