#include <bits/stdc++.h>
using namespace std;
int n, m;
const int maxn = 2e5 + 1;
const int mod = 1e9 + 7;
vector<int> v(15000002);
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(12);
}
int main() {
  init();
  long long n, m;
  cin >> n >> m;
  if (n > m) {
    long long tmp = n;
    n = m;
    m = tmp;
  }
  if (n >= 3) {
    cout << n * m - ((n * m) % 2) << endl;
  }
  if (n == 2) {
    if (m == 2)
      cout << 0 << endl;
    else if (m == 3 || m == 7)
      cout << n * m - 2 << endl;
    else
      cout << n * m << endl;
  }
  if (n == 1) {
    long long ans = 6 * (m / 6);
    m -= ans;
    if (m == 4) ans += 2;
    if (m == 5) ans += 4;
    cout << ans << endl;
  }
  return 0;
}
