#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  if (n > m) swap(n, m);
  if (n == 1) {
    cout << m / 6 * 6 + ((m % 6) >= 4 ? (m % 6 - 3) * 2 : 0) << endl;
  } else if (n >= 3) {
    cout << n * m - (((n * m) & 1) ? 1 : 0) << endl;
  } else {
    if (m == 2) {
      cout << 0 << endl;
    } else {
      if (m == 3 || m == 7) {
        cout << n * m - 2 << endl;
      } else
        cout << n * m << endl;
    }
  }
  return 0;
}
