#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand(long long l, long long r) {
  uniform_int_distribution<long long> uid(l, r);
  return uid(rng);
}
struct BipartiteMatcher {
  vector<vector<int>> G;
  vector<int> L, R, Viz;
  void init(int n, int m) {
    G.clear(), L.clear(), R.clear(), Viz.clear();
    G.resize(n), L.resize(n, -1), R.resize(m, -1), Viz.resize(n, 0);
  }
  void AddEdge(int a, int b) { G[a].push_back(b); }
  bool Match(int node) {
    if (Viz[node]) return 0;
    Viz[node] = 1;
    for (auto vec : G[node]) {
      if (R[vec] == -1 || Match(R[vec])) {
        L[node] = vec;
        R[vec] = node;
        return 1;
      }
    }
    return 0;
  }
  int Solve() {
    bool ok = 1;
    while (ok) {
      ok = 0;
      fill(Viz.begin(), Viz.end(), 0);
      for (int i = 0; i <= L.size() - 1; i++)
        if (L[i] == -1) ok |= Match(i);
    }
    int ret = 0;
    for (int i = 0; i <= L.size() - 1; i++) ret += (L[i] != -1);
    return ret;
  }
} bm;
int dx[12] = {1, 2, 2, 1, -1, -2, -2, -1, -3, 3, 0, 0};
int dy[12] = {-2, -1, 1, 2, 2, 1, -1, -2, 0, 0, -3, 3};
int a[100][100];
int go(int n, int m) {
  int cc1 = 0, cc2 = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if ((i + j) & 1)
        a[i][j] = ++cc1;
      else
        a[i][j] = ++cc2;
    }
  }
  bm.init(cc1 + 1, cc2 + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if ((i + j) & 1) {
        for (int k = 0; k <= 11; k++) {
          int x = i + dx[k], y = j + dy[k];
          if (x >= 1 && x <= n && y >= 1 && y <= m) {
            bm.AddEdge(a[i][j], a[x][y]);
          }
        }
      }
    }
  }
  return 2 * bm.Solve();
}
long long gen1(long long n) {
  long long ans = (n / 6) * 6;
  n %= 6;
  vector<bool> vis(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    if (i + 3 <= n && !vis[i] && !vis[i + 3]) {
      vis[i] = vis[i + 3] = 1;
      ans += 2;
    }
  }
  return ans;
}
long long gen2(long long n) {
  if (n <= 7) return go(2, n);
  return 2 * n;
}
long long gen3(long long n) {
  if (n <= 7) return go(3, n);
  long long ans = 20 + ((n - 6) / 2) * 4 + ((n - 7) / 2) * 2;
  return ans;
}
long long gen4(long long n) {
  if (n <= 7) return go(4, n);
  return n * 4;
}
long long gen(long long n, long long m) {
  if (n > m) swap(n, m);
  if (n == 1) return gen1(m);
  if (n == 2) return gen2(m);
  if (n == 3) return gen3(m);
  if (n == 4) return gen4(m);
  if (n % 2 == 0) return n * m;
  if (m % 2 == 0)
    return n * m;
  else
    return n * m - 1;
  return -1;
}
signed main() {
  ios_base::sync_with_stdio(0);
  long long n, m;
  cin >> n >> m;
  cout << gen(n, m);
  return 0;
}
