#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> match;
vector<bool> used;
int n, m;
const int moves[12][2] = {{-3, 0}, {-2, -1}, {-2, 1}, {-1, -2},
                          {-1, 2}, {0, -3},  {0, 3},  {1, -2},
                          {1, 2},  {2, -1},  {2, 1},  {3, 0}};
bool try_kuhn(int x, int y) {
  if (used[x * m + y]) {
    return false;
  }
  used[x * m + y] = true;
  for (auto [dx, dy] : moves) {
    int nx = x + dx;
    int ny = y + dy;
    if (nx >= 0 && nx < n && ny >= 0 && ny < m) {
      if (match[nx * m + ny] == -1 ||
          try_kuhn(match[nx * m + ny] / m, match[nx * m + ny] % m)) {
        match[nx * m + ny] = x * m + y;
        return true;
      }
    }
  }
  return false;
}
ll get(int nn, int mm) {
  n = nn;
  m = mm;
  match.assign(n * m, -1);
  used.resize(n * m);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if ((i + j) & 1) continue;
      used.assign(n * m, false);
      bool rs = try_kuhn(i, j);
    }
  }
  ll ans = 0;
  for (int i = 0; i < n * m; ++i) {
    if (match[i] != -1) {
      ans += 2;
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll nn, mm;
  cin >> nn >> mm;
  ll ans = 0;
  int mx = 15;
  if (nn > mx) {
    ll can = (nn - mx) / 6;
    ans += mm * can * 6;
    nn -= can * 6;
  }
  if (mm > mx) {
    ll can = ((mm - mx) / 6) * 6;
    ans += nn * can;
    mm -= can;
  }
  cout << ans + get(nn, mm) << endl;
}
