#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 << 6 * (m / 6) + 2 * max((long long)0, m % 6 - 3) << "\n";
  } else if (n == 2) {
    if (m < 3) {
      cout << "0\n";
    } else {
      cout << n * m - 2 * (m == 3 || m == 7) << "\n";
    }
  } else {
    cout << n * m - (n % 2 == 1 && m % 2 == 1) << "\n";
  }
  return 0;
}
