#include <bits/stdc++.h>
using namespace std;
const long long BINF = 9e18, LINF = 2e9, mod = 1e9 + 7, P = 179, Q = 1791791791;
void solve() {
  long long n, m;
  cin >> n >> m;
  if (n > m) swap(n, m);
  if (n == 1) {
    if (m % 6 == 0)
      cout << m;
    else if (m % 6 <= 3)
      cout << m / 6 * 6;
    else if (m % 6 == 4)
      cout << m / 6 * 6 + 2;
    else
      cout << m / 6 * 6 + 4;
  } else if (n <= 2 && m <= 2)
    cout << 0;
  else if (n == 2 && m == 3)
    cout << 4;
  else if (n == 2 && m == 7)
    cout << 12;
  else if (n % 2 == 0 || m % 2 == 0)
    cout << n * m << endl;
  else
    cout << n * m - 1 << endl;
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cout.precision(40);
  solve();
  return 0;
}
