#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
const double PI = acos(-1.0);
const long long INF = 1e9 + 47;
const long long LINF = INF * INF;
int dx[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1};
int dy[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2};
long long n, m;
bool ok(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; }
int odyn() {
  int ans = 0;
  int rem = m % 6;
  ans = 6 * (m / 6);
  if (rem == 4) ans += 2;
  if (rem == 5) ans += 4;
  return ans;
}
const int MAX = 25;
vector<pair<int, int> > g[MAX][MAX];
char used[MAX][MAX];
pair<int, int> mt[MAX][MAX];
bool kuhn(int x, int y) {
  if (used[x][y]) return 0;
  used[x][y] = 1;
  for (int i = (0); i < ((int)((g[x][y]).size())); ++i) {
    pair<int, int> to = g[x][y][i];
    if (mt[to.first][to.second] == make_pair(-1, -1)) {
      mt[to.first][to.second] = make_pair(x, y);
      return 1;
    }
  }
  for (int i = (0); i < ((int)((g[x][y]).size())); ++i) {
    pair<int, int> to = g[x][y][i];
    if (kuhn(mt[to.first][to.second].first, mt[to.first][to.second].second)) {
      mt[to.first][to.second] = make_pair(x, y);
      return 1;
    }
  }
  return 0;
}
void CLEAR() {
  for (int i = (0); i < (MAX); ++i)
    for (int j = (0); j < (MAX); ++j)
      mt[i][j] = make_pair(-1, -1), used[i][j] = 0, g[i][j].clear();
}
int brute() {
  CLEAR();
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (m); ++j) {
      if ((i + j) & 1) continue;
      for (int k = (0); k < (12); ++k) {
        int x = i + dx[k];
        int y = j + dy[k];
        if (!ok(x, y)) continue;
        g[i][j].push_back(make_pair(x, y));
      }
    }
  int ans = 0;
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (m); ++j) {
      if ((i + j) & 1) continue;
      for (int x = (0); x < (n); ++x)
        for (int y = (0); y < (m); ++y) used[x][y] = 0;
      ans += kuhn(i, j);
    }
  ans *= 2;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  if (n > m) swap(n, m);
  if (n == 1) {
    cout << odyn() << endl;
    return 0;
  }
  if (m < MAX) {
    cout << brute() << endl;
    return 0;
  }
  long long ans = n * m;
  if (ans & 1) --ans;
  cout << ans << endl;
  cerr << "Time elapsed : " << clock() / (double)CLOCKS_PER_SEC << endl;
  return 0;
}
