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