#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
inline int pow_(long long a, int n, int p = mod) {
  int r = 1;
  while (n) {
    if (n & 1) r = r * a % p;
    n >>= 1;
    a = a * a % p;
  }
  return r;
}
inline int inv_(int a) { return pow_(a, mod - 2, mod); }
inline int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
inline void adds(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
inline int mul(int a, int b) { return a * 1ll * b % mod; }
inline void muls(int& a, int b) { a = a * 1ll * b % mod; }
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += mod;
  return a;
}
const int MAXN = 100;
vector<vector<int> > g;
int match[MAXN], p[MAXN], base[MAXN], q[MAXN];
bool used[MAXN], blossom[MAXN];
int lca(int a, int b) {
  bool used[MAXN] = {0};
  for (;;) {
    a = base[a];
    used[a] = true;
    if (match[a] == -1) break;
    a = p[match[a]];
  }
  for (;;) {
    b = base[b];
    if (used[b]) return b;
    b = p[match[b]];
  }
}
void mark_path(int v, int b, int children) {
  while (base[v] != b) {
    blossom[base[v]] = blossom[base[match[v]]] = true;
    p[v] = children;
    children = match[v];
    v = p[match[v]];
  }
}
int find_path(int root, int n) {
  memset(used, 0, sizeof used);
  memset(p, -1, sizeof p);
  for (int i = 0; i < n; ++i) base[i] = i;
  used[root] = true;
  int qh = 0, qt = 0;
  q[qt++] = root;
  while (qh < qt) {
    int v = q[qh++];
    for (size_t i = 0; i < g[v].size(); ++i) {
      int to = g[v][i];
      if (base[v] == base[to] || match[v] == to) continue;
      if (to == root || (match[to] != -1 && p[match[to]] != -1)) {
        int curbase = lca(v, to);
        memset(blossom, 0, sizeof blossom);
        mark_path(v, curbase, to);
        mark_path(to, curbase, v);
        for (int i = 0; i < n; ++i)
          if (blossom[base[i]]) {
            base[i] = curbase;
            if (!used[i]) {
              used[i] = true;
              q[qt++] = i;
            }
          }
      } else if (p[to] == -1) {
        p[to] = v;
        if (match[to] == -1) return to;
        to = match[to];
        used[to] = true;
        q[qt++] = to;
      }
    }
  }
  return -1;
}
int max_matching(vector<vector<int> >& graph) {
  g = graph;
  int n = (int)(g.size());
  memset(match, -1, sizeof(match));
  memset(p, 0, sizeof(p));
  memset(base, 0, sizeof(base));
  memset(q, 0, sizeof(q));
  memset(used, 0, sizeof(used));
  memset(blossom, 0, sizeof(blossom));
  for (int i = 0; i < n; ++i)
    if (match[i] == -1) {
      int v = find_path(i, n);
      while (v != -1) {
        int pv = p[v], ppv = match[pv];
        match[v] = pv, match[pv] = v;
        v = ppv;
      }
    }
  int f_ans = 0;
  for (int i = 0; i < n; i++)
    if (match[i] != -1) f_ans += 1;
  return f_ans;
}
int solve(int n, int m) {
  if ((n % 2 == 0 && m >= 8) || (m % 2 == 0 && n >= 8)) return 0;
  const int PARAM = 12;
  int lastRows = n % PARAM;
  int lastCol = m % PARAM;
  vector<int> nodes;
  for (int i = 0; i < (lastCol); ++i)
    for (int j = 0; j < (lastRows); ++j) nodes.push_back(i * PARAM + j);
  sort(nodes.begin(), nodes.end());
  nodes.resize(unique(nodes.begin(), nodes.end()) - nodes.begin());
  int N = (int)(nodes.size());
  if (N == 0) return 0;
  vector<vector<int> > g(N);
  for (int i = 0; i < (N); ++i) {
    for (int j = 0; j < (N); ++j)
      if (i != j) {
        int dist = abs(nodes[i] % PARAM - nodes[j] % PARAM) +
                   abs(nodes[i] / PARAM - nodes[j] / PARAM);
        if (dist == 3) g[i].push_back(j);
      }
  }
  return N - max_matching(g);
}
int main() {
  int n, m;
  cin >> n >> m;
  long long tot = n * 1ll * m;
  int ans = solve(n, m);
  cout << tot - ans << "\n";
  return 0;
}

### Prompt

Please formulate a CPP solution to the following problem:

Little C loves number «3» very much. He loves all things about it.

Now he is playing a game on a chessboard of size n × m. The cell in the x-th row and in the y-th column is called (x,y). Initially, The chessboard is empty. Each time, he places two chessmen on two different empty cells, the Manhattan distance between which is exactly 3. The Manhattan distance between two cells (x_i,y_i) and (x_j,y_j) is defined as |x_i-x_j|+|y_i-y_j|.

He want to place as many chessmen as possible on the chessboard. Please help him find the maximum number of chessmen he can place.

Input

A single line contains two integers n and m (1 ≤ n,m ≤ 10^9) — the number of rows and the number of columns of the chessboard.

Output

Print one integer — the maximum number of chessmen Little C can place.

Examples

Input

2 2


Output

0

Input

3 3


Output

8

Note

In the first example, the Manhattan distance between any two cells is smaller than 3, so the answer is 0.

In the second example, a possible solution is (1,1)(3,2), (1,2)(3,3), (2,1)(1,3), (3,1)(2,3).

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
inline int pow_(long long a, int n, int p = mod) {
  int r = 1;
  while (n) {
    if (n & 1) r = r * a % p;
    n >>= 1;
    a = a * a % p;
  }
  return r;
}
inline int inv_(int a) { return pow_(a, mod - 2, mod); }
inline int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
inline void adds(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
inline int mul(int a, int b) { return a * 1ll * b % mod; }
inline void muls(int& a, int b) { a = a * 1ll * b % mod; }
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += mod;
  return a;
}
const int MAXN = 100;
vector<vector<int> > g;
int match[MAXN], p[MAXN], base[MAXN], q[MAXN];
bool used[MAXN], blossom[MAXN];
int lca(int a, int b) {
  bool used[MAXN] = {0};
  for (;;) {
    a = base[a];
    used[a] = true;
    if (match[a] == -1) break;
    a = p[match[a]];
  }
  for (;;) {
    b = base[b];
    if (used[b]) return b;
    b = p[match[b]];
  }
}
void mark_path(int v, int b, int children) {
  while (base[v] != b) {
    blossom[base[v]] = blossom[base[match[v]]] = true;
    p[v] = children;
    children = match[v];
    v = p[match[v]];
  }
}
int find_path(int root, int n) {
  memset(used, 0, sizeof used);
  memset(p, -1, sizeof p);
  for (int i = 0; i < n; ++i) base[i] = i;
  used[root] = true;
  int qh = 0, qt = 0;
  q[qt++] = root;
  while (qh < qt) {
    int v = q[qh++];
    for (size_t i = 0; i < g[v].size(); ++i) {
      int to = g[v][i];
      if (base[v] == base[to] || match[v] == to) continue;
      if (to == root || (match[to] != -1 && p[match[to]] != -1)) {
        int curbase = lca(v, to);
        memset(blossom, 0, sizeof blossom);
        mark_path(v, curbase, to);
        mark_path(to, curbase, v);
        for (int i = 0; i < n; ++i)
          if (blossom[base[i]]) {
            base[i] = curbase;
            if (!used[i]) {
              used[i] = true;
              q[qt++] = i;
            }
          }
      } else if (p[to] == -1) {
        p[to] = v;
        if (match[to] == -1) return to;
        to = match[to];
        used[to] = true;
        q[qt++] = to;
      }
    }
  }
  return -1;
}
int max_matching(vector<vector<int> >& graph) {
  g = graph;
  int n = (int)(g.size());
  memset(match, -1, sizeof(match));
  memset(p, 0, sizeof(p));
  memset(base, 0, sizeof(base));
  memset(q, 0, sizeof(q));
  memset(used, 0, sizeof(used));
  memset(blossom, 0, sizeof(blossom));
  for (int i = 0; i < n; ++i)
    if (match[i] == -1) {
      int v = find_path(i, n);
      while (v != -1) {
        int pv = p[v], ppv = match[pv];
        match[v] = pv, match[pv] = v;
        v = ppv;
      }
    }
  int f_ans = 0;
  for (int i = 0; i < n; i++)
    if (match[i] != -1) f_ans += 1;
  return f_ans;
}
int solve(int n, int m) {
  if ((n % 2 == 0 && m >= 8) || (m % 2 == 0 && n >= 8)) return 0;
  const int PARAM = 12;
  int lastRows = n % PARAM;
  int lastCol = m % PARAM;
  vector<int> nodes;
  for (int i = 0; i < (lastCol); ++i)
    for (int j = 0; j < (lastRows); ++j) nodes.push_back(i * PARAM + j);
  sort(nodes.begin(), nodes.end());
  nodes.resize(unique(nodes.begin(), nodes.end()) - nodes.begin());
  int N = (int)(nodes.size());
  if (N == 0) return 0;
  vector<vector<int> > g(N);
  for (int i = 0; i < (N); ++i) {
    for (int j = 0; j < (N); ++j)
      if (i != j) {
        int dist = abs(nodes[i] % PARAM - nodes[j] % PARAM) +
                   abs(nodes[i] / PARAM - nodes[j] / PARAM);
        if (dist == 3) g[i].push_back(j);
      }
  }
  return N - max_matching(g);
}
int main() {
  int n, m;
  cin >> n >> m;
  long long tot = n * 1ll * m;
  int ans = solve(n, m);
  cout << tot - ans << "\n";
  return 0;
}

```