#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  if (n < 3 && m < 3) {
    cout << "0";
    return;
  }
  if (n > m) swap(n, m);
  if (n == 1) {
    cout << m / 6 * 6 + max(0LL, m % 6 - 3) * 2;
    return;
  } else if (n == 2) {
    if (m == 3 || m == 7) m -= 1LL;
    cout << n * m << "\n";
    return;
  }
  cout << n * m - (n & m & 1);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
