#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
long long add(long long x, long long y) {
  x += y;
  if (x >= MOD) return x - MOD;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + MOD;
  return x;
}
long long mult(long long x, long long y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> m >> n;
  if (m > n) swap(m, n);
  if (m == 1) {
    int filled = (n / 6) * 6;
    int rest = max(0LL, ((n - filled) - 3) * 2);
    cout << filled + rest << endl;
  } else if (m == 2) {
    if (n == 2)
      cout << 0 << endl;
    else if (n == 3)
      cout << 4 << endl;
    else if (n == 7)
      cout << 14 - 2 << endl;
    else
      cout << n * m << endl;
  } else if (m >= 3) {
    cout << n * m - (n & 1 && m & 1) << endl;
  }
  return 0;
}
