#include <bits/stdc++.h>
using namespace std;
const int mx = 400;
vector<int> edge[mx];
bool vis[mx];
int lft[mx], rght[mx];
bool dfs(int u) {
  if (vis[u]) return false;
  vis[u] = true;
  for (int i = 0; i < edge[u].size(); i++) {
    int v = edge[u][i];
    if (rght[v] == -1) {
      rght[v] = u;
      lft[u] = v;
      return true;
    }
  }
  for (int i = 0; i < edge[u].size(); i++) {
    int v = edge[u][i];
    if (dfs(rght[v])) {
      rght[v] = u;
      lft[u] = v;
      return true;
    }
  }
  return false;
}
int match() {
  memset((lft), (-1), sizeof((lft)));
  ;
  memset((rght), (-1), sizeof((rght)));
  ;
  int ret = 0;
  bool done;
  do {
    done = true;
    memset((vis), (0), sizeof((vis)));
    ;
    for (int i = 0; i < mx; i++) {
      if (lft[i] == -1 && dfs(i)) {
        done = false;
      }
    }
  } while (!done);
  for (int i = 0; i < mx; i++) ret += (lft[i] != -1);
  return ret;
}
inline bool ok(int i, int j, int n, int m) {
  return (i < n && i >= 0 && j < m && j >= 0);
}
inline void addedge(int u, int v) {
  edge[u].push_back(v);
  edge[v].push_back(u);
  return;
}
inline long long solve(int n, int m, int x = 6) {
  int id[200][200];
  for (int i = 0, k = 0; i < n; i++)
    for (int j = 0; j < m; j++, k++) id[i][j] = k;
  for (int i = 0; i < mx; i++) edge[i].clear();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      for (int k = 0; k < 4; k++) {
        if (ok(i + k, j + (3 - k), n, m)) {
          addedge(id[i][j], id[i + k][j + (3 - k)]);
        }
        if (ok(i - k, j + (3 - k), n, m)) {
          addedge(id[i][j], id[i - k][j + (3 - k)]);
        }
      }
  return match();
}
inline long long getnn(int n) {
  long long ret = n;
  ret -= (n % 6);
  n %= 6;
  n = max(0, n - 3);
  ret += 2 * n;
  return ret;
}
inline long long solve1(int n, int m) {
  if (n % 2 == 0 && m % 2 == 0) return n * m;
  if (n % 2 == 1 && m % 2 == 1) {
    long long ret = (n - 1ll) * (m - 1ll);
    ret += getnn(n) + getnn(m - 1);
    return ret;
  }
  if (n % 2 == 1) swap(n, m);
  long long ret = 1ll * n * (m - 1);
  ret += getnn(n);
  return ret;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  long long ans = 0;
  if (m < n) swap(n, m);
  if (n < 3ll && m < 3ll)
    ans = 0ll;
  else if (n == 2ll && m == 3ll)
    ans = 4ll;
  else if (n == 2ll && m == 7l)
    ans = 12ll;
  else if (n == 1ll) {
    ans = (m / 6ll) * 6ll;
    if (m % 6 == 4) ans += 2ll;
    if (m % 6 == 5) ans += 4ll;
  } else {
    if (n % 2 == 0 || m % 2 == 0)
      ans = 1ll * n * m;
    else
      ans = 1ll * n * m - 1;
  }
  printf("%I64d\n", ans);
  return 0;
}
